finishedWithAuth not called after authenticate method

前端 未结 5 1066
天涯浪人
天涯浪人 2021-01-20 05:12

I have already set the clientID ,scope and then on button click in MyViewController ,i am calling method login from LoginCLass which works but after [signIn authenticate]

5条回答
  •  广开言路
    2021-01-20 06:11

    This happened to me too in my apps running iOS 8. What did it for me was to set the clientId in the AppDelegate as soon as the app launched, and not in the viewDidLoad method of my UIViewController class as indicated in the Google+ Sign-in for iOS example in the following URL: https://developers.google.com/+/mobile/ios/sign-in

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    /
    //Google+
    // Set app's client ID for |GPPSignIn| and |GPPShare|.
    [GPPSignIn sharedInstance].clientID = @"xxxxxx.......apps.googleusercontent.com";
    
    ...
    
    return YES;
    
    }
    

    So, in your UIViewController class the sign-in method should be:

     - (void)viewDidLoad {
    [super viewDidLoad];
    
    //Google+ for Logging in the user again if the app has been authorized
    signIn = [GPPSignIn sharedInstance];
    signIn.shouldFetchGooglePlusUser = YES;
    signIn.shouldFetchGoogleUserID = YES;
    signIn.shouldFetchGoogleUserEmail = YES;
    signIn.scopes = @[ kGTLAuthScopePlusLogin ];
    signIn.delegate = self;
    [signIn trySilentAuthentication];
    
    ...
    }
    

提交回复
热议问题