【问题标题】:prevent game kit from awarding achievement more than once防止游戏套件多次授予成就
【发布时间】:2012-09-11 10:20:31
【问题描述】:

我在我的 iPhone 游戏中使用 Game Kit,当我完成一个关卡时,我会检查如下成就:

if (timeSpentInLevel < 30) {
        GKAchievement *ach = [[GKAchievement alloc] initWithIdentifier:@"cryptoquips.achievements.solutiontime.30s"];
        ach.percentComplete = 100.0;
        ach.showsCompletionBanner = YES;
        if (ach != NULL) {
            [ach reportAchievementWithCompletionHandler:^(NSError *error) {
                if (error!= nil) {
                    NSLog(@"achievement reporting failed");
                }
            }];
        }
    }

但是当我在另一个关卡中再次执行此操作时,横幅仍然显示,我假设再次获得积分。在 iTunes Connect 中,我将成就“Achievable More than Once”设置为 no,因此不允许这样做。

如何防止此成就被多次授予?

【问题讨论】:

  • 我也有这个问题,如何多次实现玩家?

标签: iphone objective-c ios app-store-connect gamekit


【解决方案1】:

您可以使用 loadAchievementsWithCompletionHandler: 来执行此操作。它将获得玩家已经获得的成就的 NSArray。枚举这个数组,看看有没有一个是你要解锁的成就,如果没有,就解锁。

【讨论】:

    猜你喜欢
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多