handleTurnEventForMatch:didBecomeActive:callbacks只到达一些时间 [英] handleTurnEventForMatch:didBecomeActive: callbacks only arriving some of the time
问题描述
这是此问题的后续追踪。如果您没有收到对 handleTurnEventForMatch:didBecomeActive:
的任何回调,请尝试该答案。
This is a follow-up to this question. If you are not receiving any callbacks to handleTurnEventForMatch:didBecomeActive:
, try the answer there.
在我的游戏中,我只是在某些时候收到回合事件通知。但如果我回到 matchMakerViewController
并重新加载匹配,状态总是正确的。
In my game, I am only receiving turn event notifications some of the time. But if I go back to the matchMakerViewController
and re-load the match, the state is always correct.
我的游戏在每个回合期间多次上传转向状态。有趣的是,似乎如果另一个设备接收到一个对手的轮到的通知,则不太可能在同一回合接收进一步的通知。但是,这不是100%。
My game uploads the turn state multiple times during each turn. Anecdotally, it seems that if the other device receives one notification for an opponent's turn, it is less likely to receive further notifications for that same turn. However, this is not 100%.
一般来说,我的互联网连接似乎工作得很好。
In general, my internet connection seems to work pretty well.
推荐答案
我终于找出了问题。
好的,如果你使用 GKTurnBasedMatchmakerViewController
,那么它会从你当前的代理中偷走委托。
Alright, if you use the GKTurnBasedMatchmakerViewController
, then it steals the delegation from your current delegate.
它可能有像:
[GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate = self;
这是非常有意义的,因为viewcontroller需要更新,当gamecenter发生变化时, GKTurnBasedEventHandler
。
This makes perfect sense as the viewcontroller needs to update when changes occur from gamecenter, so it becomes the delegate for the GKTurnBasedEventHandler
.
如果要将委托返回到自己的对象,
If you want to return the delegation to your own object though you should put this line:
[GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate = self;
在 GKTurnBasedMatchmakerViewControllerDelegate $ c $中所有函数的最顶端c>协议。
这篇关于handleTurnEventForMatch:didBecomeActive:callbacks只到达一些时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!