GIDSignInUIDelegate Methods to getting called

前端 未结 1 1671
生来不讨喜
生来不讨喜 2020-12-22 12:27

I have a view controller on a navigation stack (2nd child).

Controller is setup as GIDSignInDelegate and GIDSignInUIDelegate.

After triggering sign-in, every

相关标签:
1条回答
  • 2020-12-22 13:15

    If the issue is occurring on iOS 11 and higher then I found this explanation in the changelog document of the framework: https://cocoapods.org/pods/GoogleSignIn/changelog

    Entry from 2017-10-17 -- v4.1.1 states:

    Fixes an issue that GIDSignInUIDelegate's signInWillDispatch:error: was not called on iOS 11. Please note that it is intended that neither signIn:presentViewController: nor signIn:dimissViewController: is called on iOS 11 because SFAuthenticationSession is not presented by the app's view controller.

    According to the above explanation signInWillDispatch:error is indeed called, but signIn:presentViewController: and signIn:dimissViewController: are intentionally not called because the underlying SFAuthenticationSession presents and dismisses sign-in flow through private API rendering the two callback methods useless. I suppose these methods are remaining in the GIDSignInUIDelegate protocol solely for the sake of backwards compatibility with iOS 10 where SFAuthenticationSession was not used and the sign in flow could be presented and dismissed from a particular view controller.

    However even though the two methods never get called on iOS 11 and higher they still need to be implemented when the delegate object is not a subclass of UIViewController, otherwise the app will crash. Obviously it's not very logical to have methods implemented which do nothing...

    On a side note, Google could do a better job at updating their documentation because now it is rather misleading: https://developers.google.com/identity/sign-in/ios/api/protocol_g_i_d_sign_in_u_i_delegate-p#a2b265097a3c78e7f82d57b2ccda11c39

    0 讨论(0)
提交回复
热议问题