handleTurnEventForMatch:didBecomeActive: callbacks only arriving some of the time

ε祈祈猫儿з 提交于 2019-12-01 16:02:32

问题


This is a follow-up to this question. If you are not receiving any callbacks to handleTurnEventForMatch:didBecomeActive:, try the answer there.

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.

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.

Any ideas what might be causing this?


回答1:


I finally figured out the problem.

Alright, if you use the GKTurnBasedMatchmakerViewController, then it steals the delegation from your current delegate.

It has probably got something like:

[GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate = self;

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;

At the very top of all function in the GKTurnBasedMatchmakerViewControllerDelegate protocol.



来源:https://stackoverflow.com/questions/14924294/handleturneventformatchdidbecomeactive-callbacks-only-arriving-some-of-the-tim

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!