arik
arik

Reputation: 29260

GKTurnBasedMatch receive data

I am trying to implement a turn-based app, and there is no problem with sending turn data, but I see no way of receiving data automatically. So far, I have found out that much:

Thanks in advance.

UPDATE: I have set [GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate to be a static instance that implements GKTurnBasedEventHandlerDelegate. It still never gets called.

Upvotes: 3

Views: 493

Answers (1)

guenis
guenis

Reputation: 2538

You set it with below statement, it becomes the delegate of a shared instance:

[[GKTurnBasedEventHandler sharedTurnBasedEventHandler] setDelegate:self];

You do not need to call loadMatchDataWithCompletionhandler manually actually, when one of the participants call endTurnWithMatchData all other participants will be notified through GKTurnBasedEventHandler delegate method:

-(void) handleTurnEventForMatch:(GKTurnBasedMatch *)match didBecomeActive:(BOOL)didBecomeActive

That's where you need to update UI. Beware that simulator does not support GKTurnBasedEventHandler delegate methods, they only get called in actual devices.

Upvotes: 3

Related Questions