Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 228
Muhammad Danish Qureshi Avatar asked Aug 27 '19 08:08

Muhammad Danish Qureshi


2 Answers

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'
like image 163
iMoeNya Avatar answered Oct 26 '22 06:10

iMoeNya


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

GIDSignIn.sharedInstance()?.uiDelegate = self

and make the ViewController conform to GIDSignInUIDelegate protocol.

like image 37
Vitaly Shpinyov Avatar answered Oct 26 '22 06:10

Vitaly Shpinyov