使用Google sdk v3.x从App Store拒绝Google +登录iOS App拒绝

拉詹(Rajan Maheshwari)

经过大量研究后,我在这里发布了我的问题。我在我的应用程序中使用Google登录最新的SDK,并且该应用程序支持iOS 8+。我目前正在使用Xcode 7.2。最近,我的应用被拒绝,原因是许多用户过去经历过的一个非常普遍的原因:

从APPSTORE中
我们注意到,该用户被带到Safari登录或注册帐户,这提供了糟糕的用户体验。具体来说,Google登录会将用户带到Safari进行登录。

下一步

10.6请修改您的应用,以允许用户登录或在该应用中注册帐户。

我们建议实现Safari View Controller API,以在您的应用程序中显示Web内容。Safari View Controller允许显示URL并通过应用程序中的嵌入式浏览器检查证书,以便客户可以验证网页URL和SSL证书以确认他们将登录凭据输入到合法页面中。
结尾

我已经知道这种拒绝,因为苹果已经拒绝了许多使Safari浏览器中的“登录”流程流出的应用程序。以下是一些供参考的链接
https://code.google.com/p/google-plus-platform/issues/detail?id=900
https://github.com/Torsten2217/google-plus-platform/issues / 900

还有一些其他链接,您可以在Internet上轻松找到

2015年5月,Google发布了具有本地网络视图的新SDK。完整的集成过程在http://www.appcoda.com/google-sign-in-how-to/中列出
它在iOS 8上运行良好,并且还提供了一个控制器。

现在,我使用的是通过CocoaPods https://developers.google.com/identity/sign-in/ios/start安装的最新google sdk,
上面的google链接包含我尝试过的iOS尝试登录示例。现在,它SFSafariViewController仅在iOS 9中打开本机,但在iOS 8中,登录流程再次从应用程序外部转到Safari浏览器。

苹果评论者在评论中要求使用,SafariViewController但控件的可用性来自iOS 9及更高版本这是链接https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller
如何在iOS 8中使用最新的Google sdk实现此目的?
审稿人都没有提及他/她正在测试的iOS版本。

现在任何人都可以帮助我解决这个问题。如何在iOS 8中管理Google登录页面的本机当前控制器。

拉詹(Rajan Maheshwari)

最后,使用最新的Google+ Sign SDK解决了该问题,该应用程序也获得了Apple的认可。我正在发布适用于iOS 9iOS 8的解决方案
使用CocoaPods进行集成。

pod 'Google/SignIn'

要开始登录,您必须执行此处开始集成”部分中所述的完全相同的步骤。

现在,在“添加登录”部分中,我希望我的自定义类中的一些自定义按钮UIViewController可以启动登录过程。在Google的开发人员链接中,他们仅在AppDelegate中进行重定向。因此,为避免这种情况,我不会GIDSignInDelegateAppDelegate课堂上使用

我只会在以下两种方法中进行更改 AppDelegate

//This is available for iOS 9 and above. So we have to use this method if we are integrating Google Sign In in iOS 9
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject])

//This is available prior iOS 9 and is available for iOS 8,7 etc. This is a deprecated method for iOS 9. You have to override this too if your app supports iOS 8 platform.
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool

因此定义如下:

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {

    if #available(iOS 9.0, *) {
        return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey] as? String)
    } else {
        // Fallback on earlier versions
    }
    return true
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {

    return GIDSignIn.sharedInstance().handleURL(url,sourceApplication: sourceApplication,annotation: annotation)
}

现在转到我们的CustomUIViewController类,即LoginViewController实现GIDSignInDelegateGIDSignInUIDelegate

class LoginViewController: UIViewController, GIDSignInDelegate, GIDSignInUIDelegate {

}

有一个用于Google +登录的自定义UIButton,其定义为

@IBAction func googleLoginButtonPressed(sender: AnyObject) {

    // Initialize sign-in
    var configureError: NSError?
    GGLContext.sharedInstance().configureWithError(&configureError)

    //assert(configureError == nil, "Error configuring Google services: \(configureError)")
    if configureError != nil {
     //Handle your error
    }else {
        GIDSignIn.sharedInstance().shouldFetchBasicProfile = true
        GIDSignIn.sharedInstance().clientID = kClientId
        GIDSignIn.sharedInstance().delegate = self
        GIDSignIn.sharedInstance().uiDelegate = self

        //This did the trick for iOS 8 and the controller is presented now in iOS 8
        //We have to make allowsSignInWithBrowser false also. If we dont write this line and only write the 2nd line, then iOS 8 will not present a webview and again will take your flow outside the app in safari. So we have to write both the lines, Line 1 and Line 2
        GIDSignIn.sharedInstance().allowsSignInWithBrowser = false  //Line 1
        GIDSignIn.sharedInstance().allowsSignInWithWebView = true   //Line 2

        GIDSignIn.sharedInstance().signIn()
    }

}

现在,实现Google +登录委托方法

func signIn(signIn: GIDSignIn!, dismissViewController viewController: UIViewController!) {
    self.dismissViewControllerAnimated(true) { () -> Void in       
    }
}

func signIn(signIn: GIDSignIn!, presentViewController viewController: UIViewController!) {
    self.presentViewController(viewController, animated: true) { () -> Void in
    }
}

func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {
    if (error == nil) {

        // Perform any operations on signed in user here.
        let userId = user.userID                  // For client-side use only!
        let idToken = user.authentication.idToken // Safe to send to the server
        let fullName = user.profile.name
        let givenName = user.profile.givenName
        let familyName = user.profile.familyName
        let email = user.profile.email
    } else {
        print("\(error.localizedDescription)")
    }
}

func signIn(signIn: GIDSignIn!, didDisconnectWithUser user: GIDGoogleUser!, withError error: NSError!) {
      //Perform if user gets disconnected
}

现在,这将在iOS 8和9中都可以使用,而无需将您的应用程序移动到Safari之外以进行Google +登录。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Google App Engine:拒绝访问网站/拒绝反向链接

来自分类Dev

Google Analytics iOS SDK 3.0.8 IDFA应用商店拒绝

来自分类Dev

App Store提交的iOS广告标识符被拒绝

来自分类Dev

使用Scribe上传Strava V3 API(在Google App Engine上)

来自分类Dev

Apple App Store拒绝5.1.5

来自分类Dev

从App Engine连接到Google Cloud SQL:拒绝访问

来自分类Dev

iOS Google登录时出现SDK问题

来自分类Dev

苹果因使用Google Maps SDK而拒绝了该应用

来自分类Dev

苹果因使用Google Maps SDK而拒绝了该应用

来自分类Dev

iOS App因了解更多链接而被拒绝

来自分类Dev

Google App脚本Calendar v3中没有Calendar.Events.delete

来自分类Dev

Google In App Billing v3处理取消被管理产品

来自分类Dev

如何使用google-plus-ios-sdk-1.7.1 sdk登录到google-plus?

来自分类Dev

如何使用google-plus-ios-sdk-1.7.1 sdk登录到google-plus?

来自分类Dev

Google Analytics Reporting API v3要求用户登录

来自分类Dev

从Google Maps V3删除“登录”标记

来自分类Dev

错误(401),需要登录-Google Calendar API v3

来自分类Dev

由于Google登录而导致的iOS拒绝。最新的Google登录(4.0.0)进入了野生动物园

来自分类Dev

“无效的工具链。” iTunes Connect是否拒绝使用Xcode 8 Beta构建的iOS 10 App Beta?

来自分类Dev

将适用于Python的Google App Engine SDK与Python 3结合使用

来自分类Dev

如何拒绝拒绝蓝鸟的promise.app()?

来自分类Dev

如何在Google App Engine中使用Facebook PHP SDK?

来自分类Dev

使用Java SDK的Google App Engine项目部署错误

来自分类Dev

Google Drive iOS SDK:显示“取消登录”按钮

来自分类Dev

Google App脚本:尝试创建文件夹时访问被拒绝

来自分类Dev

Google APP Engine PHP应用程序上的警告mkdir()权限被拒绝

来自分类Dev

Google Places API查询请求被拒绝的IOS

来自分类Dev

Google Map V3 Andorid SDK的自定义标记信息

来自分类Dev

Google Drive API v3 C#SDK无效凭据

Related 相关文章

  1. 1

    Google App Engine:拒绝访问网站/拒绝反向链接

  2. 2

    Google Analytics iOS SDK 3.0.8 IDFA应用商店拒绝

  3. 3

    App Store提交的iOS广告标识符被拒绝

  4. 4

    使用Scribe上传Strava V3 API(在Google App Engine上)

  5. 5

    Apple App Store拒绝5.1.5

  6. 6

    从App Engine连接到Google Cloud SQL:拒绝访问

  7. 7

    iOS Google登录时出现SDK问题

  8. 8

    苹果因使用Google Maps SDK而拒绝了该应用

  9. 9

    苹果因使用Google Maps SDK而拒绝了该应用

  10. 10

    iOS App因了解更多链接而被拒绝

  11. 11

    Google App脚本Calendar v3中没有Calendar.Events.delete

  12. 12

    Google In App Billing v3处理取消被管理产品

  13. 13

    如何使用google-plus-ios-sdk-1.7.1 sdk登录到google-plus?

  14. 14

    如何使用google-plus-ios-sdk-1.7.1 sdk登录到google-plus?

  15. 15

    Google Analytics Reporting API v3要求用户登录

  16. 16

    从Google Maps V3删除“登录”标记

  17. 17

    错误(401),需要登录-Google Calendar API v3

  18. 18

    由于Google登录而导致的iOS拒绝。最新的Google登录(4.0.0)进入了野生动物园

  19. 19

    “无效的工具链。” iTunes Connect是否拒绝使用Xcode 8 Beta构建的iOS 10 App Beta?

  20. 20

    将适用于Python的Google App Engine SDK与Python 3结合使用

  21. 21

    如何拒绝拒绝蓝鸟的promise.app()?

  22. 22

    如何在Google App Engine中使用Facebook PHP SDK?

  23. 23

    使用Java SDK的Google App Engine项目部署错误

  24. 24

    Google Drive iOS SDK:显示“取消登录”按钮

  25. 25

    Google App脚本:尝试创建文件夹时访问被拒绝

  26. 26

    Google APP Engine PHP应用程序上的警告mkdir()权限被拒绝

  27. 27

    Google Places API查询请求被拒绝的IOS

  28. 28

    Google Map V3 Andorid SDK的自定义标记信息

  29. 29

    Google Drive API v3 C#SDK无效凭据

热门标签

归档