Is it possible to remove points or acheivements from Game Center?
Is it possible to decrease a user's points in Game Cen开发者_如何转开发ter based on something in the app?
Straight from the GameKit Programming Guide
- (void) resetAchievements
{
// Clear all locally saved achievement objects.
achievementsDictionary = [[NSMutableDictionary alloc] init];
// Clear all progress saved on Game Center
[GKAchievement resetAchievementsWithCompletionHandler:^(NSError *error)
{
if (error != nil)
//handle errors
}];
}
I don't think it's possible to remove scores though.
The solution by James Webster is correct, I only add the following more complete solution for future reference.
For dev I use the following in my App Delegate's application:didFinishLaunchingWithOptions:
//Comment next line to prevent resetting of achievements
#define RESETACHIEVEMENTS
#if defined RESETACHIEVEMENTS
#warning RESETACHIEVEMENTS is enabled!
// Log in to GameCentre
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error)
{
if (error) {
//Handle error
} else {
// Reset achievements
[GKAchievement resetAchievementsWithCompletionHandler:^(NSError *error)
{
if (error) {
//Handle error
}
}];
}
}];
#endif
精彩评论