Google Play游戏不允许用户加入回合制匹配 [英] Google Play Games not allowing user to join turn-based match

查看:186
本文介绍了Google Play游戏不允许用户加入回合制匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  GPGMultiplayerConfig * config = [[p>] 

我创建了一个基于回合的比赛并按照如下方式邀请单个对手: GPGMultiplayerConfig alloc] init];
//我们会自动与其他玩家匹配
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 特邀

  [self.match joinWithCompletionHandler:^(NSError * error){
if(error){
completion(NO);
return;
}
}];

这不会导致错误。在调用 self.match.isMyTurn 时,我得到 YES 。调用 self.match.userMatchStatus 会给出受邀的状态;不是加入。这个文档(顺便说一下,这很糟糕)声明这个 joinWithCompletionHandler:方法:
$ b


加入玩家被邀请参加的基于回合的比赛。


即使将分派时间延迟添加到3秒后,为了给它一个机会,我发现它仍然被设置为特邀。调用其他方法,例如 takeTurnWithNextParticipantId:data:results:completionHandler:,会失败并显示完全没有记录的错误:


Error Domain = com.google.GooglePlayGames Code = 3操作无法完成
(com.google.GooglePlayGames错误3)。


以下是Google文档的链接:



我猜你是传递玩家id而不是参与者id takeTurnWithNextParticipantId。错误代码3(和http响应代码400)意味着传入的参数中的某些内容无效,在我的情况下,它是我设置错误的参与者标识。


I create a turn-based match and proceed to invite a single opponent as follows:

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;
     }
}];

After this device places the first move and passes the next turn to my opponent device, my opponent device receives the push notification to join the match. I respond by joining. At this point my self.match.userMatchStatus for this invited device is invited:

[self.match joinWithCompletionHandler:^(NSError *error) {
    if (error) {
        completion(NO);
        return;
    }
}];

This doesn't give an error. Upon calling self.match.isMyTurn, I get back YES. A call to self.match.userMatchStatus gives the status of invited; not joined. The documentation (which is incredibly poor, by the way) states that this joinWithCompletionHandler: method:

Joins a turn-based match that the player has been invited to.

Even when adding a dispatch time delay in of 3 seconds after this, to give it a chance, I find that it's still set to invited. Calling further methods, such as takeTurnWithNextParticipantId:data:results:completionHandler:, fails with an entirely undocumented error:

Error Domain=com.google.GooglePlayGames Code=3 "The operation couldn’t be completed. (com.google.GooglePlayGames error 3.)"

Here's a link to Google's documentation:

https://developers.google.com/games/services/ios/api/interface_g_p_g_turn_based_match

解决方案

I guess you are passing the player id instead of participant id to takeTurnWithNextParticipantId. The error code 3 (and http response code 400) means that something in passed parameters is invalid, in my case it was the participant id which i had set wrong.

这篇关于Google Play游戏不允许用户加入回合制匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆