I am working on a turn-based game GameCenter. A GKTurnBasedMatch is created using GKMatchRequest , with minPlayers and maxPlayers set to 2. I get an NSInvalidArgumentException when I try to end the game using endMatchInTurnWithMatchData , telling me that I did not set matchOutcome for all participants. The logs for the match object right before this point show that my match is as follows:
<GKTurnBasedMatch 0x1c1f2af0 - matchID:c9de6e47-0e9a-4dbe-944b-d2fd4ecd3044 bundleID:com.mybundle.wd status:GKTurnBasedMatchStatusEnded message:'Game Over' creationDate:2013-10-08 01:26:12 +0000 currentParticipant:(null) participants: <GKTurnBasedParticipant 0x1c184820 - playerID:G:128458444 (local player) status:Done matchOutcome:Lost lastTurnDate:2013-10-10 21:54:22 +0000 timeoutDate:(null)>, <GKTurnBasedParticipant 0x1c1b0a80 - playerID:G:220673962 status:Done matchOutcome:Lost lastTurnDate:2013-10-10 18:26:16 +0000 timeoutDate:(null)>, <GKTurnBasedParticipant 0x16ef1610 - playerID:G:128458444 (local player) status:Active matchOutcome:None lastTurnDate:(null) timeoutDate:(null)>, <GKTurnBasedParticipant 0x16ec64f0 - playerID:(null) status:Matching matchOutcome:None lastTurnDate:(null) timeoutDate:(null)> matchData.length:871 matchDataMaximumSize:65536 exchanges:(null)>
I have more than 2 GKTurnBasedParticipants , and two of them are the same player! I am not doing anything extraordinary in the game, except that you call the following move:
[match endTurnWithNextParticipants:@[nextParticipant] turnTimeout:GKTurnTimeoutDefault matchData:data completionHandler:^(NSError *error){...}]
Does anyone know what is going on here? This is a two-player game, since I can get into the object of a confused match, and how can I prevent this?
source share