I'm trying to integrate Game Center on a watchOS app but I'm unable to authenticate the Local Player.
Maybe I'm missing any step to allow the companion watchOS app to access Game Center as the iOS app does?
Setup
- iOS App Deploying target for iOS 14
- Companion watchOS App that supports running without iOS App installation, target watchOS 7
- Game Center capability is active both on iOS and watchOS App Extension targets
- The app is not live yet, but already on "Prepare for Submission" on App Store Connect
- Game Center checkbox is on, on App Store Connect
- There are a few Leaderboards already created on App Store Connect
- iOS app is able to connect to Game Center for authenticating, submitting scores, and displaying leaderboards
- When testing on the simulator I have an iPhone paired with a Watch. Sandbox account is authenticated on the iPhone.
- When testing on a real device I have an iPhone paired with a Watch, real account is authenticated on the iPhone.
Already tried
On the watchOS App Extension I'm calling:
GKLocalPlayer.local.authenticateHandler = { error in
}
Which is very similar to the method used to authenthicate on iOS, and on iOS it works, even on the simulator.
When calling that method, and running on a simulator I get this log on Xcode's debug area:
[Error] _authenticateUsingAlert:Failed to authenticate player with existing credentials.Error: Error Domain=GKErrorDomain Code=6 "The requested operation could not be completed because local player has not been authenticated." UserInfo={NSLocalizedDescription=The requested operation could not be completed because local player has not been authenticated.}
and the error message received on the completion handler is:
Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo={NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server.}
When testing the same scenario on a real device I get the log:
[Error] _authenticateUsingAlert:Failed to authenticate player with existing credentials.Error: Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognised by Game Center." UserInfo={GKServerStatusCode=5019, NSUnderlyingError=0x11e3a6c0 {Error Domain=GKServerErrorDomain Code=5019 "status = 5019, no game matching descriptor: ios:com.myApp.test.watch.extension::0+-1" UserInfo={GKServerStatusCode=5019, NSLocalizedFailureReason=status = 5019, no game matching descriptor: ios:com.myApp.test.watch.extension::0+-1}}, NSLocalizedDescription=The requested operation could not be completed because this application is not recognised by Game Center.}
and the error from the completion handler is:
Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognised by Game Center." UserInfo={NSLocalizedDescription=The requested operation could not be completed because this application is not recognised by Game Center.}
Both these errors are similar to the messages you get on iOS when the app hasn't enabled Game Center on App Store Connect. As mentioned before this is not the case as on iOS works fine.
I also tried moving the app to a Game Center Group on App Store Connect, as it says this is meant to share leaderboards and achievements, but the result was the same.