handleTurnEventForMatch:didBecomeActive: callbacks only arriving some of the time
Asked Answered
R

1

8

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?

Romeliaromelle answered 17/2, 2013 at 18:7 Comment(2)
Have the same issue. When application is launched handleTurnEventForMatch method called for the same match times to time.Cosmology
Having exactly the same problem. Most of the time only one device can send to the other, and the other can't reply. But it's the one-way direction is different from match to match.Athanasius
A
9

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.

Athanasius answered 13/3, 2013 at 11:14 Comment(3)
I'm glad this works for some people. Alas, it does not appear to be working for me.Romeliaromelle
I'm having the same problem but your suggested solution does not help (on iOS 6.1.x i.e.). I'm asserting that the delegate is still what I want it to be at the very top of all functions in the said protocol, and none of these fails. If Apple were to steal the delegate in its implementation of GKTurnBasedMatchmakerViewController, why would it not restore the value before calling any of these functions?Obverse
It was the only reason,handleTurnEventForMatch was not getting called. +1Toaster

© 2022 - 2024 — McMap. All rights reserved.