I am developing a turn based game using the Game Center. I handle the invitations to play using the following code::
GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite* acceptedInvite, NSArray *playersToInvite)
{
if(acceptedInvite != nil)
{
// Get a match for the invite we obtained...
NSLog(@"Valor de la invitacion %@",acceptedInvite);
[[GKMatchmaker sharedMatchmaker] matchForInvite:acceptedInvite completionHandler:^(GKMatch *match, NSError *error)
{
if(match != nil)
{
NSLog(@"match != nil: ");
}
else if(error != nil)
{
NSLog(@"ERROR: From matchForInvite: %@", [error description]);
}
else
{
NSLog(@"ERROR: Unexpected return from matchForInvite...");
}
}];
}
};
I woudl like to have a list of all the GKInvite that I received to have them in a tableview, and later the user will decide to accept the invitation to play the game or reject it. Of course I am using my own view to handle all the Game Center options.
Any solution??
For turn- based games, you'll have to use
GKTurnBasedMatchmakerinstead ofGKMatchmaker.Furthermore, I believe you'll only see
GKTurnBasedMatchobjects for games that the user has accepted by swiping the invitation.