G + sdk给出登录错误?

时间:2012-12-26 06:36:30

标签: ios google-plus

我已经实施了Google Plus Api并在网站上提供了登录信息。但是当我点击允许访问时,登录后会出现问题,如下所示:

enter image description here

出现以下消息:

enter image description here

我的代码如下,请告诉我如果还有什么:

    - (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 个答案:

答案 0 :(得分:44)

您必须在项目中使用您的捆绑ID分配重定向uri,这样在成功验证后,如果您正确处理您的网址,您的应用程序将从safari启动:

enter image description here

将捆绑ID作为标识符和URLSchemes ...