3

I'm trying to clear all my matches in Game Center, and I'm using the following code to do so:

if ([GKLocalPlayer localPlayer].authenticated == NO) {
    [[GKLocalPlayer localPlayer] setAuthenticateHandler:^(UIViewController*   viewcontroller, NSError *error) {
         [GKTurnBasedMatch loadMatchesWithCompletionHandler: ^(NSArray *matches, NSError *error){
              for (GKTurnBasedMatch *match in matches) {
                  NSLog(@"Match ID:%@", match.matchID);
                  [match removeWithCompletionHandler:^(NSError *error){
                      NSLog(@"%@", error);}];
              }}];
     }];
} else {
    NSLog(@"Already authenticated!");
}

And this works for almost all my games, except a few which all have 0 participants. The description of these games is as follows:

GKTurnBasedMatch 0x17eb78b0 - matchID:2e36f8fe-5b07-4fea-9e8f-6997187f2235 bundleID:Mad-Shark-GamesTEST.Letterslide status:GKTurnBasedMatchStatusOpen message:(null) creationDate:2014-03-14 23:44:06 +0000 currentParticipant:(null) participants:(null) matchData.length:0 matchDataMaximumSize:65536 exchanges:(null)

I've seen the post on removing invalid games, but my error is not caused by an invite, and I have no participants to change the state. Unfortunately I can't remember exactly what I did to cause this error, and I've been trying to replicate it but so far no "luck". Can anyone help me figure out what could have caused this and how to clear out these games? Thank you!!

MadShark
  • 139
  • 1
  • 9

1 Answers1

0

I know it's a long time since you posted the question, but today i came up to a similar situation and my solution was to "force" participantQuitOutOfTurnWithOutcome:, even if i had no participants.

         [updatedMatch participantQuitOutOfTurnWithOutcome:GKTurnBasedMatchOutcomeQuit withCompletionHandler:^(NSError *error)
          {
              if (error)
              {}
              else
              {}
          }];
Macaret
  • 797
  • 9
  • 33