是否可以根据应用中的内容减少用户在Game Center中的积分?
答案 0 :(得分:2)
- (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
}];
}
我认为不可能删除分数。
答案 1 :(得分:0)
James Webster的解决方案是正确的,我只添加以下更完整的解决方案以供将来参考。
对于开发人员,我在App Delegate的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