开发者

game center achievements unlock

开发者 https://www.devze.com 2023-02-20 13:43 出处:网络
I want to add achievements to my app. I added a achievement in itunesconnect and found this method in the reference library:

I want to add achievements to my app. I added a achievement in itunesconnect and found this method in the reference library:

-(void) reportAchievementIdentifier: (NSString*) identifier percentComplete: (float) percent {
GKAchievement *achievement = [[[GKAchievement alloc] initWithIdentifier: identifier] autorelease];
if (achievement)
{
    achieveme开发者_如何学运维nt.percentComplete = percent;
    [achievement reportAchievementWithCompletionHandler:^(NSError *error)
     {
         if (error != nil)
         {
             // Retain the achievement object and try again later (not shown).
         }
     }];
} }

so I added this to my app. now I want that the achievement is unlocked when an int has the value 5. how could a method look like that unlocks this achievement when the int is 5?


it would be:

if(myInt >= 5)
{
[self reportAchievementIdentifier:@"myAchievement1" percentComplete:100];
}
0

精彩评论

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