G+ sdk giving login error?

2019-04-05 02:57发布

I have implemented Google Plus Api and login as it is given in the site. But it is giving problem after login when I click on allow Access as shown below:

enter image description here

The following message appears :

enter image description here

My Code is as follows,pls tell me If anything left:

    - (void)viewDidLoad
{
 self.signInButton.delegate = self;
 self.signInButton.clientID = kClientId;
 self.signInButton.scope = [NSArray arrayWithObjects:
                            @"https://www.googleapis.com/auth/plus.me",
                            nil];

 SLNetworkAppDelegate *appDelegate = (SLNetworkAppDelegate*)
 [[UIApplication sharedApplication] delegate];
 appDelegate.signInButton = self.signInButton;

 share =[[GPPShare alloc] initWithClientID:kClientId];
 share.delegate = self; // optional
 appDelegate.share=share;

    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (IBAction) didTapShare: (id)sender {
 [[[[share shareDialog]
    setURLToShare:[NSURL URLWithString:@"https://developers.google.com/+/mobile/ios/getting-started"]]
   setPrefillText:@"testing share via google plus"] open];

 // Or, without a URL or prefill text:
 [[share shareDialog] open];
}


In App delegate file:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
 if ([signInButton handleURL:url
           sourceApplication:sourceApplication
                  annotation:annotation]) {
  return YES;
 }
 if ([self.share handleURL:url
         sourceApplication:sourceApplication
                annotation:annotation]) {
  return YES;
 }
 return NO;
}

1条回答
Lonely孤独者°
2楼-- · 2019-04-05 03:16

You have to assign redirect uri in your project with your bundle ID like this so after successful authentication your application will be launched from safari if your handle your url properly:

enter image description here

Place bundle Id as identifier and URLSchemes...

查看更多
登录 后发表回答