Post

Replies

Boosts

Views

Activity

Reply to Issues Surrounding GKPlayer's playerId Deprecation in iOS 13
I noticed that when switching Game Center accounts the GKLocalPlayer authenticateHandler is called 3 times in quick succession (which in itself is not ideal). The first 2 times teamPlayerID and gamePlayerID return "UnknownID" but on the 3rd call it displays the correct IDs. However, the legacy playerID displays correctly all 3 times. The GKPlayerAuthenticationDidChangeNotificationName which I have used in the past to reliably track users changing accounts is only called once on switch which is correct, however, it returns "UnknownID" for teamPlayerID and gamePlayerID, rendering it unusable unless I stick with the legacy playerID which still works as expected. Since the authenticateHandler returns the correct IDs eventually, I could work around it by ignoring invalid IDs and waiting until they become valid. But this would be hacky, and leave me having to check against a particular ID format which is usually not recommended as the formats could change. It's 2024 and I'm also heavily considering sticking with the legacy playerID as it works perfectly.
Jan ’24