繁体   English   中英

是否可以从Game Center中删除积分或成绩?

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

是否可以根据应用中的内容减少用户在游戏中心的积分?

直接来自GameKit编程指南

- (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
    }];
}

我不认为有可能删除分数。

James Webster的解决方案是正确的,我只添加以下更完整的解决方案以供将来参考。

对于开发人员,我在App Delegate的application:didFinishLaunchingWithOptions:使用以下内容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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM