【发布时间】:2014-09-05 03:52:07
【问题描述】:
我创建了一个回合制比赛并继续邀请单个对手,如下所示:
GPGMultiplayerConfig *config = [[GPGMultiplayerConfig alloc] init];
// We will automatically match with one other player
config.invitedPlayerIds = @[self.opponent.googlePlayID];
config.minAutoMatchingPlayers = 0;
config.maxAutoMatchingPlayers = 0;
[GPGTurnBasedMatch
createMatchWithConfig:config
completionHandler:^(GPGTurnBasedMatch *match, NSError *error) {
if (error) {
completion(NO);
return;
}
}];
在此设备先下手并将下一回合传递给我的对手设备后,我的对手设备会收到加入比赛的推送通知。我通过加入来回应。此时我的self.match.userMatchStatus 为这个受邀设备是invited:
[self.match joinWithCompletionHandler:^(NSError *error) {
if (error) {
completion(NO);
return;
}
}];
这不会出错。致电self.match.isMyTurn 后,我回复YES。对self.match.userMatchStatus 的调用给出invited 的状态;不是joined。文档(顺便说一句,这非常糟糕)指出这个joinWithCompletionHandler: 方法:
加入玩家受邀参加的回合制比赛。
即使在此之后添加 3 秒的调度时间延迟,为了给它一个机会,我发现它仍然设置为 invited。调用其他方法(例如 takeTurnWithNextParticipantId:data:results:completionHandler:)失败并出现完全未记录的错误:
Error Domain=com.google.GooglePlayGames Code=3 "操作失败 完成。 (com.google.GooglePlayGames 错误 3。)”
这里是 Google 文档的链接:
https://developers.google.com/games/services/ios/api/interface_g_p_g_turn_based_match
【问题讨论】:
-
我遇到了同样的错误,无法确定是怎么回事,您解决了吗?
标签: ios objective-c google-play-services google-play-games