Google +使用google sdk v3.x从appstore登录iOS App拒绝 [英] Google + login iOS App rejection from appstore using google sdk v3.x

查看:133
本文介绍了Google +使用google sdk v3.x从appstore登录iOS App拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过深入挖掘后,我在这里发布了我的问题。我在我的应用程序中使用谷歌登录最新的sdk,该应用程序支持iOS 8+。我目前正在使用Xcode 7.2。最近我的应用被拒绝了许多用户过去经历过的非常常见的原因:

After digging a lot I am here posting my problem. I am using google sign in latest sdk in my app and the app supports iOS 8+. I am using Xcode 7.2 currently. Recently my app got rejected with the very common reason which many users have experienced in the past:

来自APPSTORE

我们注意到用户被带到Safari登录或注册帐户,这提供了糟糕的用户体验。具体来说,Google登录会让用户登录Safari。

FROM APPSTORE
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience. Specifically, Google log in takes users to Safari to sign in.

后续步骤

10.6 请修改您的应用以使用户能够在应用中登录或注册帐户。

10.6 Please revise your app to enable users to sign in or register an account in the app.

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

结束

We recommend implementing the Safari View Controller API to display web content within your app. The Safari View Controller allows the display of a URL and inspection of the certificate from an embedded browser in an app so that customers can verify the webpage URL and SSL certificate to confirm they are entering their sign in credentials into a legitimate page.
END

我已经知道这种拒绝,因为苹果已经拒绝了很多正在使用Sign的应用在Safari浏览器中流出。以下是一些供参考的链接

https://code.google.com/p/google-plus-platform/issues/detail?id=900
https://github.com/Torsten2217/google-plus-platform/issues/900

I already know this rejection as apple has rejected lot of apps which are taking the Sign In flow out in the Safari browser. Here are some of the links for reference
https://code.google.com/p/google-plus-platform/issues/detail?id=900
https://github.com/Torsten2217/google-plus-platform/issues/900

以及您可以在互联网上轻松找到的更多链接

and some more links you can easily find on Internet

2015年5月,Google发布了一个带有原生网页视图的新sdk。此处列出了完整的集成过程 http://www.appcoda.com/谷歌 - 登录 - 如何做/
它在iOS 8上运行良好,并且还提供了一个控制器。

On May 2015 Google released a new sdk with native web view. The complete process of integration is listed here http://www.appcoda.com/google-sign-in-how-to/.
It was working fine with iOS 8 and was presenting a controller too.

现在我使用的是我通过CocoaPods安装的最新google sdk
< a href =https://developers.google.com/identity/sign-in/ios/start\"rel =noreferrer> https://developers.google.com/identity/sign-in/ios/start

google上面的链接有一个尝试登录iOS 示例,我试过了。它现在只在iOS 9中打开原生 SFSafariViewController ,但在iOS 8中,登录流程再次从应用程序外部移植到Safari浏览器。

Now I was using the latest google sdk which I installed via CocoaPods https://developers.google.com/identity/sign-in/ios/start
The above link from google has a Try Sign-In for iOS sample which I tried. It is now opening a native SFSafariViewController in iOS 9 only but in iOS 8 the login flow is again going outside the app to Safari browser.

在评论中,apple reviewer要求使用 SafariViewController ,但控件的可用性来自 iOS 9及以上。这是链接 https://developer.apple.com/library/ios/ documentation / SafariServices / Reference / SFSafariViewController_Ref /
如何在iOS 8中使用最新的google sdk实现这一目标。

评论者既未提及他/她正在测试的iOS版本。

In the comments apple reviewer asked to use SafariViewController but the availability of the control is from iOS 9 and above.Here is the link https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/
How can I achieve this with latest google sdk in iOS 8.
The reviewer has neither mentioned the iOS version he/she was testing.

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

Now can anyone help me in sorting this out. How can I manage in iOS 8, the native present controller for Google Login page.

推荐答案

最后问题是最新的Google+ Sign SDK和该应用也获得了Apple的批准。我正在为 iOS 9 iOS 8 发布解决方案。
使用 CocoaPods 进行整合。

Finally the problem is sorted out with latest Google+ Sign SDK and the app is also approved by Apple. I am posting a solution for both iOS 9 and iOS 8.
Use CocoaPods for integration.

pod 'Google/SignIn'

要从登录开始,您必须执行开始集成部分中提到的完全相同的步骤在这里

To start with login you have to do exactly the same steps mentioned in the Start Integrating Section here

现在在添加登录部分,我想要一些自定义按钮自定义类 UIViewController 以启动登录过程。在Google的开发人员链接中,他们仅在AppDelegate中重定向。所以为了避免这种情况,我不会在我的 AppDelegate 类中使用 GIDSignInDelegate

Now in the Add Sign-In part, I want some custom button in my custom class of UIViewController to initiate the login process. In the developer link of Google, they are redirecting in AppDelegate only. So to avoid this I will not be using GIDSignInDelegate in my AppDelegate class

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

I will only be making changes in the following two methods of 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)
}

现在转到我们的自定义 UIViewController 类,即 LoginViewController ,实现 GIDSignInDelegate GIDSignInUIDelegate

Now moving on to our Custom UIViewController class i.e LoginViewController, implement the GIDSignInDelegate and GIDSignInUIDelegate

class LoginViewController: UIViewController, GIDSignInDelegate, GIDSignInUIDelegate {

}

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

There is a custom UIButton for Google + login whose definition is

@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 +登录实施委托方法

Now the implementation of delegate methods for Google + Sign In

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 +中的登录目的。

Now this will work in both iOS 8 and 9 without moving your app outside to Safari for Login purpose in Google +.

这篇关于Google +使用google sdk v3.x从appstore登录iOS App拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆