7

iOS 6.0 has added a couple of new instance methods to the class GKTurnBasedMatch. I am not sure how to use them:

acceptInviteWithCompletionHandler
declineInviteWithCompletionHandler

Are they supposed to be used in response to receiving a turn-based match invite? Turn-based match invites are received through the GKTurnBasedEventHandlerDelegate protocol method: handleInviteFromGameCenter.

- (void) handleInviteFromGameCenter:(NSArray *)playersToInvite

handleInviteFromGameCenter does not provide a GKTurnBasedMatch instance to use for the purposes of accepting or declining. Consequently I do not know how to use them in response to an invite.

The only methods that provide GKTurnBasedMatch instances are:

+ loadMatchesWithCompletionHandler
+ findMatchForRequest:withCompletionHandler

I am not sure why I would use acceptInviteWithCompletionHandler on the results of loadMatchesWithCompletionHandler, because they are matches I am already participating in.

I am not sure why I would use either of them with findMatchForRequest:withCompletionHandler, because this is being called to find a match. Am I supposed to accept the match after finding it?

<- Update ->

I have found one use for declineInviteWithCompletionHandler. If a user requests to delete a match they have not taken a turn in, I call declineInviteWithCompletionHandler. This way they are not recorded as having quit the match.

When a player has not yet taken a turn, their GKTurnBasedParticipant.lastTurnDate is null

If a user requests to play a match (that I have displayed in a list using loadMatchesWithCompletionHandler) and if the local player has not taken a turn in the match, I am calling acceptInviteWithCompletionHandler, before I display the match to the player. I'm not sure if this is necessary, it just seemed like the right thing to do.

Jay Haase
  • 1,979
  • 1
  • 16
  • 36
  • Did you solve the issue?I have the same issue with ios6 – Aitul Apr 26 '13 at 12:33
  • 1
    @Aitul, I solved the issue by using the API in the way described under <- Update ->. It seems to be working fine, my app is in the app store, and many players are using it. – Jay Haase Apr 27 '13 at 03:27
  • I can not find the "Update" part. Could you send me the link?I am dealing with this issue for 3 weeks – Aitul Apr 27 '13 at 09:31
  • It's just the bottom part of my question (up above), the two paragraphs after the the text: <- Update -> – Jay Haase Apr 27 '13 at 13:21
  • Plz check my question http://stackoverflow.com/questions/16266089/gkmatchrequest-invitation-not-showing-in-other-device, I dont understand why I am not getting the notification in the otehr device. Could be the issu related with handleInviteFromGameCenter or GKTurnBasedEventHandlerDelegate?? – Aitul Apr 30 '13 at 15:38

0 Answers0