beim Start, ich versuche, programmatisch auf den Game-Center-Server zwischen meinen Geräten alle Spiele zu löschen, indem Sie den Aufruf dieser Methode auf jedem Gerät:removeWithCompletionHandler Fehler
/**
* called to authenticate the players game centre id
*/
- (void)authenticateLocalUser
{
if (!self.gameCentreAvailable) return;
NSLog(@"Authenticating Local User.");
if ([GKLocalPlayer localPlayer].authenticated == NO)
{
[[GKLocalPlayer localPlayer] setAuthenticateHandler:^(UIViewController* viewcontroller, NSError *error)
{
NSLog(@"Inside Authentication Handler.");
// if there was no error, and we got a valid view controller to display
if (!error && viewcontroller)
{
// get a handle to the app delegate
AppDelegate *delegate = [UIApplication sharedApplication].delegate;
// use the view controller in the app delegate to present the authentication view controller
[delegate.viewController presentViewController:viewcontroller animated:YES completion:
^{
// once the view controller has been displayed, register the change in authentication
[self authenticationChanged];
}];
// set this class as the event handler delegate
GKTurnBasedEventHandler *event = [GKTurnBasedEventHandler sharedTurnBasedEventHandler];
event.delegate = self;
}
// load all of the matches the player is currently a part of
[GKTurnBasedMatch loadMatchesWithCompletionHandler:^(NSArray *matches, NSError *error)
{
NSLog(@"Error loading matches: %@", error);
// for each match
for (GKTurnBasedMatch *match in matches)
{
// log the id of the match
NSLog(@"ID of match we are removing: %@", match.matchID);
// and then remove it
[match removeWithCompletionHandler:^(NSError *error)
{
NSLog(@"Error removing match: %@", error);
}];
}
}];
}];
}
else
NSLog(@"Already Authenticated.");
}
Allerdings ist die Methode nicht funktioniert, und stattdessen bin ich mit diesem Fehler in der Konsole empfangen:
2012-11-05 08: 32: 39,699 Spinning Yarn [6266: 907] Fehler beim Entfernen des Spiels: Fehler Domain = GKErrorDomain-Code = 17 „die angeforderten Operationen konnte nicht abgeschlossen werden, weil ein oder mehrere Parameter sind ungültig. " Userinfo = 0x1e5b2140 {NSLocalizedDescription = Die angeforderten Operationen konnte nicht abgeschlossen werden, weil ein oder mehrere Parameter sind ungültig.}
Der einzige Fehler, der im Inneren des removeWithCompletionHandler passiert: Alles andere ist in Ordnung, und es sind keine Fehler.
Jede Hilfe wäre genial.
Was sagt 'Fehler' im' loadMatchesWithCompletionHandler'-Vervollständigungshandler? –
Ich habe das Protokoll des Loading Matches-Fehlers eingefügt, um zu zeigen, dass tatsächlich kein Fehler vorliegt. –
sieht aus wie viele Fehler für mich Mann –