繁体   English   中英

使用适用于iOS的Google登录在Google+上分享

[英]Sharing on Google+ using Google Sign-In for iOS

由于Google+ iOS SDK使用移动版Safari对用户进行身份验证,因此我的某个应用遭到拒绝。 我已浏览网页,我一直在关注此链接中的解决方案,以启动我的应用并运行Google+。 我最近看到了Google登录iOS的公告,它解决了使用SDK提供的webview在应用内进行身份验证的问题。

这就是出现问题的地方,我希望用户能够在Google+上分享,但我无法在Google登录SDK中看到要分享的选项,而最新的Google+ SDK仍在使用移动版Safari进行身份验证。 我现在有两个问题:

  1. 我可以同时使用两个SDK来验证和共享和使用authCode吗?
  2. 我是否遗漏了这两个SDK中的内容以进行登录或共享? Google+是否可以选择在应用内进行身份验证,还是Google登录有助于在Google+上进行分享?
NSURL *shareURL = [NSURL URLWithString:@"https://blog.xamarin.com/keep-users-engaged-with-ios-9s-sfsafariviewcontroller/"];
    // Construct the Google+ share URL
    NSURLComponents* urlComponents = [[NSURLComponents alloc]
                                      initWithString:@"https://plus.google.com/share"];
    urlComponents.queryItems = @[[[NSURLQueryItem alloc]
                                  initWithName:@"url"
                                  value:[shareURL absoluteString]]];
    NSURL* url = [urlComponents URL];

if ([SFSafariViewController class]) {
    // Open the URL in SFSafariViewController (iOS 9+)
    SFSafariViewController* controller = [[SFSafariViewController alloc]
                                          initWithURL:url];
    controller.delegate = self;
    [self presentViewController:controller animated:YES completion:nil];
} else {
    // Open the URL in the device's browser
    [[UIApplication sharedApplication] openURL:url];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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