Hi all,
I'm working on my first game, and the first step of getting the authenticator view is not working. To simplify the problem, I made a brand new app which only has the following code in the main view controller:
import GameKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
GKLocalPlayer.local.authenticateHandler = { viewController, error in
NSLog("GameKit authenticating")
if let vc = viewController {
NSLog("IT WORKED! \(vc.description)")
} else {
NSLog(error!.localizedDescription)
}
}
}
}
I've looked through older, similar issues, and so I made sure that I'd done the following:
- Game center is enabled in the app's Capabilities in Xcode.
- I've created an app associated with the bundle ID in App Store Connect.
- In the app's Services tab, I've created two leader boards, one "classic single".
- Also in Services, I've created one achievement.
- In the app's "prepare for submission" panel, I've turned on gamecenter, linked the leaderboards, and linked the achievement.
- For this test app, I have not yet uploaded a build, but I did do so on the actual game app, and and that didn't fix it.
And with all that done, in my logs, it looks like this:
2022-01-16 16:28:01.582366-0800 test1ofgamecenter[6863:1006170] [Account Error] startAuthenticationForExistingPrimaryPlayer:Failed to Authenticate player.Error: Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognized by Game Center." UserInfo={NSLocalizedDescription=The requested operation could not be completed because this application is not recognized by Game Center.}
2022-01-16 16:28:01.976807-0800 test1ofgamecenter[6863:1006170] GameKit authenticating
2022-01-16 16:28:01.976988-0800 test1ofgamecenter[6863:1006170] The requested operation could not be completed because this application is not recognized by Game Center.```
I notice that my achievements and leaderboard are not "live" and I presume that is because I have not submitted the app for review, but I want to get it working before I submit a build that I would expect and want to be rejected.
Is there anything else I need to do? Does this configuration require human intervention by Apple staff members? I started this phase of the development Friday evening, so I guess it'd make sense if waiting until Monday would fix it, but that seems weird.
Any help?
Vital Stats:
- M1 Macbook Air
- Xcode 13.2.1 (13C100)
- Macos Monterey 12.1
- Testing on an iPhone XR and a 2021 iPad Mini, both with the most recent updates of their respective OS's
Ho-ly heck.
I can only imagine that the folks at Apple rebooted something or shook something loose, because I've been doing the add-a-leaderboard and add-an-achievement thing repeatedly for days, and this time, after they decided that my case was a "code level inquiry", it suddenly started working.
I've literally done this every day for the past week. But now it works, so I'm happy.
So the short answer to the question is:
- Follow the steps they recommend.
- Beyond the steps they recommend, add a leaderboard and an achievement.
- If that doesn't work, open a developer support ticket.
- Once they reject the ticket, try adding another leaderboard or an achievement.
- ???
- Profit!
Anyway, I'm happy it works. Thanks for checking in and following up on this post!