handleTurnEventForMatch:didBecomeActive: callbacks only arriving some of the time

只愿长相守 提交于 2019-12-01 16:39:35
Theis Egeberg

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.

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