GoogleSignIn-iOS
GoogleSignIn-iOS copied to clipboard
[GIDSignIn signInWithConfiguration:..] too draconian with NS_EXTENSION_UNAVAILABLE
v6.1.0 of the SDK changed some of the methods in GIDSignIn to become unavailable to extensions. Whilst I can understand the motive, I think this is too draconian a change. In my app, I have a shared library that is used by the main app itself and various extensions. This library includes the Google sign-in support, but that side of things is only ever used by the app itself, not the extensions and the code already ensures you aren't running as an extension before attempting to sign-in. But with 6.1.0, my library no longer builds as it hits this error:
'signIn(with:presenting:callback:)' is unavailable in application extensions for iOS: The sign-in flow is not supported in App Extensions.
Whilst I 'could' refactor my library to extract out the non-extension friendly parts into another shared library, this is no small undertaking and provides no real-world benefit for the time involved.
I have a couple of solutions:
- Just revert the change that added
NS_EXTENSION_UNAVAILABLEto the various calls. - Add explicit equivalents of the
NS_EXTENSION_UNAVAILABLEcalls that make it clear that its OK to include them in a library, but that they MUST not be actually called from an extension.
For now, my only solution is to just limit my SDK usage to pre 6.1.0 versions.
Have you considered defining a macro for your extension target and using the preprocessor to exclude the calls to NS_EXTENSION_UNAVAILABLE methods in your library at build time?