iphone - ERROR : You are not the current participant. 当我是当前参与者时。什么?

标签 iphone ios objective-c game-center gkturnbasedmatch

我正在开发一款回合制 iOS 游戏,但遇到了一个奇怪的错误。当我实际验证我确实是当前参与者时,它说我不是当前参与者。 在这里,我检查我是否是当前参与者,这会输出“相等”,但是当我尝试结束我的回合时,它会显示“错误:您不是当前参与者。”

if ([match.currentParticipant.playerID 
isEqualToString:GKLocalPlayer.localPlayer.playerID])
    {
        NSLog(@"Equal");
        }
        else
        {
            NSString* stringA, *stringB;
            stringA = @"Current Participant %@", match.currentParticipant;
            stringB = @"Me: %@", GKLocalPlayer.localPlayer.playerID;
            NSLog(stringA);
            NSLog(stringB);
        }
        // Pack up the game data.
        NSData* gameData = [NSKeyedArchiver archivedDataWithRootObject:game];
        [self endTurnWithMatch:game.match AndData:gameData];
    }

这到底是怎么回事!?

最佳答案

我是个笨蛋。在我的“endTurnWithMatch”函数中,我的“ERROR”以某种方式逃脱了我的 else block ,并且在我每次运行该函数时都在执行。

关于iphone - ERROR : You are not the current participant. 当我是当前参与者时。什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16891709/

相关文章:

网络服务

iphone - CALayer 使用的简单示例——也许在 UITextField 中

iphone - 如何在NavigationController上弹出UIViewController并同时推送UIView

ios - 如何在 Swift 4 CoreData 中设置合并策略

iphone - 如何调用 - (BOOL)应用程序 :(UIApplication *)application handleOpenURL:(NSURL *)url from another class

objective-c - 为什么在swift中使用@Objc?

ios - swift : Error when swiping up

ios - 如何查找特定字符在 NSString 中以大写形式出现的次数?

ios - 运行 react native ios 应用程序时找不到文件依赖项错误

ios - tableview.reloadData() 上的 UISwitch 约束和动画中断