简体   繁体   中英

Gamekit / Gamecenter achievements not reporting correctly during testing

I am currently working on a Swift/SwiftUI game with GameCenter / Gamekit integration.

I have successfully integrated game kit for leaderboards/scores, but I am having issues with achievements.

At the moment I am not sure if the problem lies with the testing procedure or with the code itself.

Just for background:

  • App is currently published in the app store with a live leaderboard
  • App version that is published does not have any achievements
  • I have added achievements to the AppStoreConnect section
                    if self.parent.levelCount == 5 {
                        print("I Entered Level 5")
                        
                        
                        let achievement = GKAchievement.init(identifier: "level5", player: GKLocalPlayer.local)
                          achievement.percentComplete = 100
                          achievement.showsCompletionBanner = true
                        
                          GKAchievement.report([achievement]) { (error) in
                            print(error?.localizedDescription ?? "")
                          }
                        
                        
                    }

The above code runs, it enters the loop once the user reaches level 5, I get no errors, but I am unable to see the achievements once I enter gamecenter.

Is there something I need to change in the testing procedure in order to see achievements before publishing a new version of the app?

Or am I doing something wrong with the implementation of the code?

Any help is greatly appreciated, Daniel

After digging a little bit in the Apple developer forums I was able to find other users with the same issue.

In order to test achievements in the development version of the application, you must go to AppStore connect and in a new version of the app toggle the achievements you are testing (you do not need to publish the version).

AppStore 连接部分成就添加到应用程序

As mentioned by Daniel DE you have to create the app version you want to attach the achievements to. Also make sure that you created an achievement in the Services -> GameCenter tab before. Then add the achievements to your version and they should show up after some time in your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM