Check if you've already unlocked an achievement in Game Center/GameKit

岁酱吖の 提交于 2019-12-06 02:15:38

to load the previously submitted achievements for the currently logged user you need to call:

[GKAchievement loadAchievementsWithCompletionHandler: ^(NSArray *scores, NSError *error)
{
    if(error != NULL) { /* error handling */ }
    for (GKAchievement* achievement in scores) {
        // work with achievement here, store it in your cache or smith
    }

}];

You know the absolutely best way to start with Game Center - achievements and high scorers is to have a look at the demo project Apple has online here: http://developer.apple.com/library/ios/#samplecode/GKTapper/Introduction/Intro.html

Have a look at the code - it's simple enough to quickly grasp what's going on and it features local achievement cache, submitting to different leader boards, etc. etc.

Am about to start implementing this myself.

From what I read of the docs what I think what you need to do is call

loadAchievementsWithCompletionHandler: 

http://developer.apple.com/library/ios/documentation/GameKit/Reference/GKAchievement_Ref/Reference/Reference.html#//apple_ref/doc/uid/TP40009959-CH1-SW1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!