Frage

I'm working on a turn based iOS game and am getting a weird error. 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."

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!?

War es hilfreich?

Lösung

I am an idiot. In my "endTurnWithMatch" function, my "ERROR" somehow escaped my else block and was executing every time I ran the function.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top