iOS Google+ SignIn finishedWithAuth not called after application openURL delegate

廉价感情. 提交于 2019-12-25 03:54:12

问题


iOS Google+ SignIn finishedWithAuth never triggered after the application:openURL:sourceApplication:annotation: app delegate method. This was working, but now it does not.

The response is:

url:com.**************:/oauth2callback?state=19139956&code=4/<some token string>&authuser=0&num_sessions=1&prompt=consent&session_state=9efdca9285835ed58ace73b284e4f7521076fc97..4291*

The signIn instance is a class member, so I don't know what happens for the finishedWithAuth triggering.

Thanks!


回答1:


  -(void)googlePluseLogin
{
    GPPSignIn *signIn  = [GPPSignIn sharedInstance];
    signIn.delegate = self;
    signIn.shouldFetchGooglePlusUser = YES;
    signIn.shouldFetchGoogleUserEmail = YES;
    signIn.clientID = kClientID;
    signIn.scopes = @[@"profile"];
    if (![signIn trySilentAuthentication])
        [signIn authenticate];
}

-(void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error
{
    NSLog(@"%@",auth);

    if (error)
    {

    }
    else
    {
    }

}



回答2:


You need to call GPPURLHandler handleURL in your application:openURL:sourceApplication:annotation: method, and you need to have setup the delegate on [GPPSignIn sharedInstance] before. I am guessing that you don't set the delegate until after the GPPURLHandler has been processed.




回答3:


I forgot to setup a URL Type as shown in Step 3



来源:https://stackoverflow.com/questions/25238221/ios-google-signin-finishedwithauth-not-called-after-application-openurl-delegat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!