Saving the current GIDGoogleUser instead of signing in on every launch Saving the current GIDGoogleUser instead of signing in on every launch ios ios

Saving the current GIDGoogleUser instead of signing in on every launch


Are you sure you have not user signed out or even disconnected somewhere?

I'm always checking whether the user has either currently signed in or has previous authentication saved in using hasAuthInKeychain (e.g. in viewWillAppear):

private func checkIfGoogleUserIsAuthorized() {    if GIDSignIn.sharedInstance().hasAuthInKeychain() {        // User was previously authenticated to Google. Attempt to sign in.        GIDSignIn.sharedInstance().signInSilently()    } else {        // User was not previously authenticated to Google.        self.updateUI()    }}

In case there is no authentication saved, you must trigger silent sign in and handle reply with your implementation of GIDSignInDelegate protocols didSignInForUser method.


If, in your project, the class that implements GIDSignInUIDelegate is a subclass of UIViewController, then don't implement the

signInWillDispatch:error: signIn:presentViewController:signIn:dismissViewController:

methods of the GIDSignInUIDelegate protocol.

Remove these methods from your view controller if you added.but you should conform the GIDSignInUIDelegate protocol without implementing the methods.

It will fix your error -4.

Please refer Google developers guide for assistance