Get a list of all GKInvite to list them in a TableView

105 views Asked by At

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??

1

There are 1 answers

0
NSSplendid On

For turn- based games, you'll have to use GKTurnBasedMatchmaker instead of GKMatchmaker.

Furthermore, I believe you'll only see GKTurnBasedMatch objects for games that the user has accepted by swiping the invitation.