开发者

Is it possible to remove points or acheivements from Game Center?

开发者 https://www.devze.com 2023-04-10 17:09 出处:网络
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

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
0

精彩评论

暂无评论...
验证码 换一张
取 消