简体   繁体   中英

Google+ iOS Sign-In Error “com.google.GTMHTTPFetcher”

I'm stuck in a very irritating issue for the last 3 days. I have implemented the Google+ sign-in and it worked just fine till I upgraded from G+ iOS SDK version 1.5.1 to 1.7.1. I did exactly like it is mentioned in Google Developers . After when I press the login button, it goes to Safari or Google+ application on the device and switches back to my application with an error which I cannot resolve.

This is how I have implemented,

StartScreenViewController.h

#import <GooglePlus/GooglePlus.h>

@interface StartScreenViewController : UIViewController <GPPSignInDelegate> {

    GPPSignIn *signIn;

}

StartScreenViewController.m

#import <GoogleOpenSource/GoogleOpenSource.h>

static NSString * const kClientId = @"********-*************.apps.googleusercontent.com";

- (void)initUI {

btnGooglePlus = [UIButton buttonWithType:UIButtonTypeCustom];
    [btnGooglePlus addTarget:self action:@selector(loginWithGooglePlus:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btnGooglePlus];

}

- (void)viewDidLoad {

    signIn = [GPPSignIn sharedInstance];
    signIn.shouldFetchGooglePlusUser = YES;
    signIn.shouldFetchGoogleUserEmail = YES;
    signIn.clientID = kClientId;
    signIn.scopes = @[ kGTLAuthScopePlusLogin ];
    signIn.delegate = self;

}

-(void)loginWithGooglePlus:(id)sender {

[signIn authenticate];

}

It switches back to app and calls the delegate method -(void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error

What I'm getting is an error message: Error Domain=com.google.GTMHTTPFetcher Code=-1 "The operation couldn't be completed. (com.google.GTMHTTPFetcher error -1.)"

I even implemented the GPPSignInButton and it also gives the same result. I have no idea why it happens. If anyone can point me to the right direction, that will be a great help.

Thanks.

I works with G+ SDK a few days ago and everything was fine. My implementation differs from yours in that I didn't set any scopes and use authentication only after trySilentAuthentication like this:

-(void)loginWithGooglePlus:(id)sender {
    if (![signIn trySilentAuthentication]) {
         [signIn authenticate];
    }
}

You should also try to remove old keychain data via disconnect

I managed to solve the issue. It was not a problem with my coding. Actually it was the Splunk that was causing all the issues. After integrating splunk, it affect the response that comes from Google+ . Had to remove and implement another crash reporting tool solved my issue. Hope this will help to anyone who will come across this issue.

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM