Reputation: 141
I'm trying to include Achievements to my game, but the problem is that when I try them using GKTapper Apple Docs' example I'm not earning any achievement. For example: the first Ach. is earned when you tap 100 times a button. But when trying it on the simulator I don't earn this achievement.
CODE:
http://developer.apple.com/library/ios/#samplecode/GKTapper/Introduction/Intro.html
From here I copied AppSpecificValues.h, GameCenterManager.h and .m
Then I declare them in my ViewController
and I use this to check the progress:
- (void) checkAchievements
{
NSString* identifier = NULL;
double percentComplete = 0;
switch(self.currentScore)
{
case 10:
{
identifier= kAchievement10Taps;
percentComplete= 100.0;
break;
}
}
if(identifier!= NULL)
{
[self.gameCenterManager submitAchievement: identifier percentComplete: percentComplete];
}
}
And I finally try on the simulator, but as I said the Achievements don't progress.
What I am doing wrong??
Lots of thanks!!
If it is useful I read how to do that here:
Upvotes: 2
Views: 2972
Reputation: 2206
It looks like your doing it right, so until you provide me with more info on whats wrong with your code, debugger output, etc.
Notes: In case you don't include lines: default: break;
in your switch statement, add them.
How about some good links if they can help you.
A tutorial for game center achievements is right here.
You should look at this tutorial from raywenderlich.com for creating GameCenter games:
The first part of the tutorial is right here. The source code project download is at the bottom.
The second part of the tutorial is right here. The source code project download is at the bottom.
*Edit, that means you haven't implemented some of the methods in the tutorials, the methods work together and you don't have all the pieces.
Upvotes: 1