GameCenter now unusable pre iOS 13 - GKLocalPlayer.local crashes app under iOS 12 when building with Xcode 11 Beta 1/2/3/4

Thanks a lot for the iOS 13 Game Center refresh!

Unfortunately I found that Game Center has since not been usable pre iOS 13 anymore.


To reproduce the issue please try the following:


- New Xcode project

- Set target to pre iOS 13, e.g. iOS 12, in my case the target is iOS 11

- Import GameKit and call GKLocalPlayer.local somewhere in code, for example by assigning it to a let constant

- Run this code on an iOS 12 device (I haven’t tried if it occurs in simulator)

- CRASH


This is a critical issue for every app that uses GKLocalPlayer with the new tool chain and Xcode 11, but still provides support for pre iOS 13.


I have already submitted FB6152841 but wanted to still let you know this way too, because this should be something that all apps that do something with Game Center should encounter.


Groovy greetings!

Replies

The issue persists with Beta 4. I've filed bug reports, tried hunting down the engineer responsible for Game Center, but so far I've unfortunately gotten no reaction or response. What else can I do?

I fear that I won't be able to ship an iOS 13 update this fall. I can't bump up the target to iOS 13 just so that I can continue using Game Center.

It looks to me like GKLocalPlayer.local is new in iOS 13, and the one you want to be calling is GKLocalPlayer.localPlayer. I'm not sure why they decided to change it.

https://developer.apple.com/documentation/gamekit/gklocalplayer/3074556-local

https://developer.apple.com/documentation/gamekit/gklocalplayer/1515401-localplayer

It has been GKLocalPlayer.localPlayer() until iOS 13, now there's both GKLocalPlayer.localPlayer and GKLocalPlayer.local. Both seem to be the same, as they work in iOS 13 and crash in everything below iOS 13.

If you jump to the definition by command-clicking GKLocalPlayer.localPlayer you'll find this comment. It's been there, unchanged with the last 4 betas:


// TODO: deprecate this  Swiftification: Should update objective C APIs to match our changes in swift (GKLocalPlayere.localPlayer -> local, nullability, lightweight generics)


It seems Game Center was about to be refactored at some point and someone just randomly stopped working on it and nothing happened since then. I really hope someone gets assigned to this task, it's frustrating not being able to use Game Center at all!

This has been resolved with Xcode 11 Beta 5! 🙂

Thanks a lot to whoever did this!