问题描述:

I'm integrating Google Plus sign in with my iOS app. On the login screen when the Login with Google+ button has been tapped I call authenticate, the SDK opens the browser and after user consents they are taken back to my app and logged in, no problem about that. Then, on a subsequent app start, in my AppDelegate's application: didFinishLaunchingWithOptions: method I'm calling trySilentAuthentication to see if the user has already been authenticated before. The documentation says that once trySilentAuthentication finishes, it should call finishedWithAuth:error: method from the delegate, but that never happens. Also, when I check trySilentAuthentication's result, it returns YES, but nevertheless GPPSignIn's authentication property is nil, which confuses me. Anyone can help?

网友答案:

Have you set the delegate to GPPSignIn? It should look something like this

[GPPSignIn sharedInstance].delegate = self;

where self is the same class that calls trySilentAuthentication and same class that has implementation of finishedWithAuth:error:

网友答案:

After struggling with this for some hours I realized that when trySilentauthentication is called from didFinishLaunchingWithOptions it almost never calls finishedWithAuth:error: However if you call it in any other method than didFinishLaunchingWithOptions it works. It also works if you call it in one of your View Controllers rather than the App Delegate.

相关阅读:
Top