GameCenter:endTurnWithNextParticipants不前进

在沙盒环境中,我无法将转身比赛推向下一位选手。

初始条件:

  • 设备A和设备B上的玩家A和玩家B.
  • 都login到沙箱
  • 两个玩家都可以看到彼此的GC状态消息
  • 玩家A创build一个匹配并邀请玩家B
  • 玩家A结束

在我的“转弯”function中,我执行以下操作:

NSLog(@"size = %ld", updatedMatchData.length); //move the current player to the bottom of the list NSMutableArray *nextPlayers = (NSMutableArray *)theMatch.participants; NSLog(@"%@", [nextPlayers description]); GKTurnBasedParticipant *firstGuy = nextPlayers[0]; [nextPlayers removeObjectAtIndex:0]; [nextPlayers addObject:firstGuy]; NSLog(@"------"); NSLog(@"%@", [nextPlayers description]); //send the match to the servers //"theMatch" was recorded in turnBasedMatchmakerViewController:didFindMatch [theMatch endTurnWithNextParticipants:nextPlayers turnTimeout:GKTurnTimeoutDefault matchData:updatedMatchData completionHandler:^(NSError *error) { if (error) { NSLog(@"WTF?"); } }]; 

这会产生以下日志输出:

 size = 26926 ( "<GKTurnBasedParticipant 0x174018630 - playerID:G:1084583147 (local player) status:Active matchOutcome:None lastTurnDate:(null) timeoutDate:(null)>", "<GKTurnBasedParticipant 0x174018ba0 - playerID:G:12962188 status:Invited matchOutcome:None lastTurnDate:(null) timeoutDate:(null)>" ) ------ ( "<GKTurnBasedParticipant 0x174018ba0 - playerID:G:12962188 status:Invited matchOutcome:None lastTurnDate:(null) timeoutDate:(null)>", "<GKTurnBasedParticipant 0x174018630 - playerID:G:1084583147 (local player) status:Active matchOutcome:None lastTurnDate:(null) timeoutDate:(null)>" ) 

但是,玩家B没有收到邀请或回合。 玩家B的游戏中心应用程序显示没有活动的游戏或轮到。 玩家A的游戏中心继续表明,他仍然有待轮到。 每次我重新开始并重新执行testing时,玩家A都会有一个未决的回合。

玩家A在玩家结束转牌后触发玩家:receivedTurnEventForMatch:didBecomeActive,但didBecomeActive被设置为NO。

所以我把超时时间改为30秒。 玩家A结束回合30秒后,玩家A发生了攻击didBecomeActive(no)。 PlayerB最终收到邀请提示。 玩家B的火焰didBecomeActive,值为YES。

为什么我的回合不会在玩家A结束回合之后立即向玩家B前进? 为什么玩家A似乎有另外一个回合(然后超时并传递给玩家B)?

终于解决了这个。 不要尝试编辑匹配对象。 不要直接编辑matchData或匹配的任何其他组件。 创build一个副本,做任何你需要做的副本,并重新提交副本。

我对玩家进行sorting的尝试产生了各种不稳定的结果,直到我创build了一个完全独立的参与者数组并对其进行sorting。 然后它像广告一样工作。