Hello!
Apple is forcing us (more recently) to support “Sign-In with Apple” next to “Connect with Facebook”, if we have the latter feature in our games.
I’ve written iOS Native extensions before (using various native SDKs), but all were following a very specific pattern, consisting mainly of defining some static functions inside a namespace, which can be called from Haxe via Lib.load(); As long as all the native SDK code I needed could be nicely encapsulated in those static methods, I was fine.
But for Apple Sign-in, the Objective-C examples I’ve managed to find (like this one: https://github.com/karthiksaral/Sign-In-with-Apple) make use of a custom UIViewController implementation to define some delegates on it, implementing the ASAuthorizationControllerDelegate and ASAuthorizationControllerPresentationContextProviding interfaces.
Basically I could start the sign-in process from a static method, but then I have to pass a .delegate and a .presentationContextProvider to an ASAuthorizationController object there, and that object should implement those two interfaces mentioned above. And I think it also has to be some sort of display context in which the system can present the authorization interface to the user i.e. an UIViewController maybe?
I know how to obtain an UIViewController doing [[[UIApplication sharedApplication] keyWindow] rootViewController], but I don’t know how to get those delegates into it.
My understanding of Objective-C is very shaky at best. I also have no idea how I could use Swift to make iOS Lime Native Extensions, but that’s a bit of a divergent topic and I’m not sure it would really help with the issue at hand.
The thing is that this requirement is suddenly a showstopper for anybody who makes games with OpenFL and wants to publish them on AppStore, but support Facebook login as an option, as they now must get “Sign-in with Apple” on board too. That’s why I hope my question would possibly help many others, if we can find an answer together.
Thank you!