iOS 6.0 has added a couple of new instance methods to the GKTurnBasedMatch class. I am not sure how to use them:
acceptInviteWithCompletionHandler declineInviteWithCompletionHandler
Are they expected to be used in response to a turn-based game invitation? Rotation-based prompts are accepted through the GKTurnBasedEventHandlerDelegate protocol method: handleInviteFromGameCenter.
- (void) handleInviteFromGameCenter:(NSArray *)playersToInvite
handleInviteFromGameCenter does not provide an instance of GKTurnBasedMatch for use with acceptance or rejection. Therefore, I do not know how to use them in response to an invitation.
The only methods that GKTurnBasedMatch instances provide are:
+ loadMatchesWithCompletionHandler + findMatchForRequest:withCompletionHandler
I'm not sure why I should use acceptInviteWithCompletionHandler according to the results of loadMatchesWithCompletionHandler, because they are matches that I already participate in.
I'm not sure why I would use any of them with findMatchForRequest: withCompletionHandler, because it is called to find a match. Should I accept the match after it is discovered?
<- Update β
I found one application for declInviteWithCompletionHandler. If the user asks to delete the match, they did not make a turn, I call declInviteWithCompletionHandler. Thus, they are not recorded as a way out of the match.
When a player has not yet completed a turn, their GKTurnBasedParticipant.lastTurnDate is null
If the user requests a match (which I displayed in the list using loadMatchesWithCompletionHandler), and if the local player did not make a turn in the match, I call acceptInviteWithCompletionHandler before displaying the match with the player. I'm not sure if this is necessary, it just seemed right.
Jay haase
source share