Reputation: 1935
I have implemented GameKit with achievements and leaderboards in my game. I've tested both and they seem to work. But in order to test them correctly from the beginning (I did some tests by trials and errors) is there any way to start again completely erasing both? I tried deleting the app form the GameCenter app of the simulation/phone but when I login again and iOS register the app in GameCenter everything re-appears. Furthermore I implemented one achievement that can be achieved more than ones. This achievement gives 50 points. Actually I can achieve it more than ones in the game in fact I get the pop-up each time. However in the achievement list I can only see 50 points and not more, possible? Perhaps, I didn't get the meaning of achievable more than ones..
EDIT: I'm trying to solve this with the following method
func resetAchievements() {
// Clear all progress saved on Game Center
GKAchievement.resetAchievementsWithCompletionHandler() {(error) in
self.lastError = error
}
}
But it works only when I install the app in the device and not in the Simulator, why? Perhaps because I don't understand the Apple's Guide
class func resetAchievementsWithCompletionHandler(_ completionHandler: ((NSError!) -> Void)!)
Upvotes: 1
Views: 1596
Reputation: 450
The following will reset all the achievements your local player has earned. You cannot earn an achievement more than once, what you are doing is posting the final value over and over again which is showing you the completion alert. The earned more than once option allows you to accept challenges from friends on that achievement. I recommend reading the introduction guide again as both of these topics are discussed in detail.
[GKAchievement resetAchievementsWithCompletionHandler: ^(NSError *error)
{
if(error == NULL)
{
NSLog(@"Achievements have been reset");
}
else
{
NSLog(@"There was an error in resetting the achievements: %@", [error localizedDescription]);
}
}];
Upvotes: 3