Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

handleTurnEventForMatch:didBecomeActive: callbacks only arriving some of the time

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?

like image 227
William Jockusch Avatar asked Feb 17 '13 18:02

William Jockusch


1 Answers

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.

like image 105
Theis Egeberg Avatar answered Oct 18 '22 15:10

Theis Egeberg