简体   繁体   English

错误:您不是当前参与者。 当我是当前的参与者。 什么?

[英]ERROR: You are not the current participant. When I am the current participant. What?

I'm working on a turn based iOS game and am getting a weird error. 我正在开发一款基于回合制的iOS游戏,我遇到了一个奇怪的错误。 It says I am not the current participant when I have actually verified that I am indeed the current participant. 它说当我确实证实我确实是当前的参与者时,我不是当前的参与者。 Here I check to see if I am the current participant, and this outputs "Equal" but then when I try to end my turn it says "ERROR: You are not the current participant." 在这里,我检查我是否是当前的参与者,并输出“Equal”,但是当我试图结束轮到时它说“错误:你不是当前的参与者”。

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];
    }

What the heck is going on here!? 这到底是怎么回事!?

I am an idiot. 我是一个白痴。 In my "endTurnWithMatch" function, my "ERROR" somehow escaped my else block and was executing every time I ran the function. 在我的“endTurnWithMatch”函数中,我的“ERROR”以某种方式逃脱了我的else块并且每次运行该函数时都在执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM