I am developing an iPhone application using Google Plus.
When I try to login, I get a 401 error.
I used google-plus-ios-sdk-1.7.1 sdk.
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[GPPSignIn sharedInstance].clientID = kClientID;
// Read Google+ deep-link data.
[GPPDeepLink setDelegate:self];
[GPPDeepLink readDeepLinkAfterInstall];
return YES;
}
In the shareviewcontroller
:
-(void)viewDidLoad
{
[super viewDidLoad];
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
signIn.delegate = self;
[[GPPSignIn sharedInstance] trySilentAuthentication];
_shareConfiguration = [ShareConfiguration sharedInstance];
_shareConfiguration.useNativeSharebox = YES;
//_shareConfiguration.deepLinkEnabled = YES;
_shareConfiguration.mediaAttachmentEnabled = YES;
}
-(void)btnGoogleShare_Action
{
if ([GPPSignIn sharedInstance].authentication) {
id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
[(id<GPPNativeShareBuilder>)shareBuilder attachImage:self.imgView.image];
[(id<GPPNativeShareBuilder>)shareBuilder setTitle:self.dict[@"title"] description:self.dict[@"comment"] thumbnailURL:nil];
[shareBuilder open];
}
else
{
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
GPPSignInButton *sign = [[GPPSignInButton alloc] init];
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
appDelegate.alert = [[UIAlertView alloc] initWithTitle:@"Sign to Google +" message:@"After login to Google+, Please retry again." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Cancel", nil];
[appDelegate.alert setValue:sign forKey:@"accessoryView"]; //works only in iOS7
} else {
appDelegate.alert = [[UIAlertView alloc] initWithTitle:@"Sign to Google +" message:@"After login to Google+, Please retry again.\n\n\n" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Cancel", nil];
sign.frame = CGRectMake(70, 85, 100, 40);
[appDelegate.alert addSubview:sign];
}
[GPPSignInButton class];
[appDelegate.alert show];
}
}
Below is a screenshot, can anyone help me?