简体   繁体   中英

Value of type 'GIDSignIn' has no member 'presentingViewController'

I am learning the google sign-in to app with GoogleSignIn SDK (Installed with cocoapods). I did not specify version in pod file, its automatically installed GoogleSignIn (4.4.0). Going Through the documentation here . According to documentation, To add sign in button we have to write

GIDSignIn.sharedInstance()?.presentingViewController = self

  // Automatically sign in the user.
  GIDSignIn.sharedInstance()?.restorePreviousSignIn()

but in latest Xcode Version 10.3 (10G8) i am getting error

Value of type 'GIDSignIn' has no member 'presentingViewController'
Value of type 'GIDSignIn' has no member 'restorePreviousSignIn'

I tried to search about the updated version for this but unfortunately not found. Kindly help me out to integrate GoogleSignIn

Your code is correct if you are using Google Sign-In v5.0 :

GIDSignIn.sharedInstance()?.presentingViewController = self

But since you've installed 4.4.0, you should accept Vitaly Shpinyov's answer .


Or upgrade Google Sign-In to 5.0 or higher by editing your podfile:
 pod 'GoogleSignIn', '~> 5.0'

In viewDidLoad() of your ViewController add the following line:

GIDSignIn.sharedInstance()?.uiDelegate = self

and make the ViewController conform to GIDSignInUIDelegate protocol.

在 GoogleSignIn 5.0 版本中,您可以执行以下操作

GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM