我正在开发一款基于回合制的 GameCenter 游戏。AGKTurnBasedMatch
是用GKMatchRequest
,minPlayers
和maxPlayers
设置为 2 创建的。我有一段NSInvalidArgumentException
时间试图用 结束游戏endMatchInTurnWithMatchData
,告诉我我没有设置matchOutcome
所有参与者。在此之前匹配对象的日志显示我的匹配如下所示:
<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)>
我GKTurnBasedParticipants
这里有2个以上,其中两个是同一个玩家!我在游戏中没有做任何特别的事情,除了每回合调用以下内容:
[match endTurnWithNextParticipants:@[nextParticipant] turnTimeout:GKTurnTimeoutDefault matchData:data completionHandler:^(NSError *error){...}]
有谁知道这里发生了什么?这是一个两人游戏,那么我怎么会得到一个混乱的匹配对象,我该如何防止这种情况呢?