2013-06-03 19 views
0

我正在做一個基於回合的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]; 
    } 

這到底是怎麼回事?

+0

嘗試寫得更清楚明確地表達你的問題。以便其他人可以理解你想要做什麼 – alpha

回答

2

我是個白癡。在我的「endTurnWithMatch」函數中,我的「ERROR」以某種方式逃脫了我的else塊,並在每次運行函數時都執行。