如何回复GKTurnBasedExchange?间歇性地调用GKLocalPlayerListener委托receiveExchangeReplies [英] How do I reply to a GKTurnBasedExchange? GKLocalPlayerListener delegate receivedExchangeReplies is called intermittently

查看:58
本文介绍了如何回复GKTurnBasedExchange?间歇性地调用GKLocalPlayerListener委托receiveExchangeReplies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有几篇文章讨论了Game Center的推送通知在沙箱中的可靠性如何.但是,沙盒已被iOS 9所迷惑,因此,我不确定为什么我的Game Center推送通知是如此不可靠.

There are a handful of posts discussing how Game Center's push notifications were fairly unreliable in the sandbox. However, the sandbox is obfuscated with iOS 9 so, I'm not sure why my Game Center push notifications are so unreliable.

当我回复活动的交换时,很少通知发件人.

When I reply to the active exchange, the sender is rarely notified.

[exchange replyWithLocalizableMessageKey:@"EXCHANGE_REPLY" arguments:@[] data:data completionHandler:^(NSError *error) {

            if (error)
            {
                NSLog(@"");
            }
        }];

在发送者设备上,如果刷新匹配数据,我会看到待处理的回复.如果我处理回复,一切正常.

On the senders device, if I refresh the match data, I'll see a pending reply. If I process the reply, everything works.

此方法也是如此:

- (void)sendExchangeToParticipants:(NSArray<GKTurnBasedParticipant *> *)participants
                          data:(NSData *)data
         localizableMessageKey:(NSString *)key
                     arguments:(NSArray<NSString *> *)arguments
                       timeout:(NSTimeInterval)timeout
             completionHandler:(void(^__nullable)(GKTurnBasedExchange *exchange, NSError *error))completionHandler

在这一点上,我认为我最好的选择是运行自己的推送通知逻辑以触发更新匹配数据.那个或我已经读过,发送提醒更为可靠,尽管我相信这方面存在限制.

At this point, I'm thinking my best option is to run my own push notification logic to trigger updating match data. That or I've read that sending reminders is more reliable though I believe there are throttling limits around that.

更新

我尝试仅使用设备而不使用模拟器.同样的问题.看起来这是一个众所周知的问题.

I've tried using only devices and not the simulator. Same issue. Looks like it's a pretty well known problem though. It's even noted in this book on page 766.

更新

发送提醒没有帮助.

更新

通常在回复交换时,我会从GameKit中收到此错误.

Often when replying to an exchange, I'll get this error from GameKit.

The connection to service named com.apple.gamed was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.

推荐答案

由于Apple后端的错误,直到2020年10月为止,交易所从未真正按照需要或指定的方式工作.但是,现在,一位苹果工程师似乎暗示它已得到修复-请我验证它是否有效.我打算使用我的公共项目来尽快执行该操作(我只需要更新Xcode): https://github.com/Gatada/TurnBasedGameFlow

Exchanges has until Oct 2020 never actually worked as needed, nor as specified, due to a bug in the Apple backend. Now however, an Apple engineer seem to suggest it has been fixed - asking me to verify that it works. Which I intend to do ASAP (I just need to update Xcode) using my public project: https://github.com/Gatada/TurnBasedGameFlow

更多详细信息

基于回合的交换依赖于交换完成后收到通知的回合持有者,因此回合持有者可以解决该问题(将其提交给Game Center).但是,此通知从未被转交给转弯持有人.

A turn based exchange relies on the turn holder being notified when the exchange is completed, so the turn holder can resolve it (submit it to Game Center). This notification however, was never pushed to the turn holder.

此错误的结果是,我们制作的游戏不得不依靠回合持有人在交换完成后重新加载游戏,并且由于游戏数据不足,我们的代码不得不妥善处理回合提交失败的问题.-sync(由完成的交换引起).

As a result of this bug, the games we made had to rely on the turn holder re-loading the game after the exchange completes, and our code had to gracefully handle the turn submission failing due to game data being out-of-sync (caused by the completed exchange).

在WWDC 2020期间,我与苹果进行了一对一的游戏中心会议,在那里我用确凿的证据报告了这个问题(毕竟,该错误自2010年以来就存在),这使苹果工程师深信不疑.他们花了3个月才回到我身边,而我又花了3个月才回到他们身边-嘿,把我们带到了现在.

I had a one-on-one Game Center session with Apple during WWDC 2020, where I reported this issue with hard evidence (after all, this bug had been around since 2010) which convinced the Apple engineer. It took them 3 months to get back to me, and another 3 months for me to get back to them - hehe, bringing us to now.

这篇关于如何回复GKTurnBasedExchange?间歇性地调用GKLocalPlayerListener委托receiveExchangeReplies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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