谷歌+;使用google sdk v3.x从appstore登录iOS应用程序拒绝

谷歌+;使用google sdk v3.x从appstore登录iOS应用程序拒绝,ios,google-login,sfsafariviewcontroller,Ios,Google Login,Sfsafariviewcontroller,在挖掘了很多之后,我在这里发布我的问题。我正在我的应用程序中使用谷歌登录最新sdk,该应用程序支持iOS 8+。我目前使用的是Xcode 7.2。最近,我的应用程序被拒绝,原因很常见,很多用户在过去都经历过: 来自APPSTORE 我们注意到用户被带到Safari登录或注册帐户,这提供了糟糕的用户体验。具体来说,谷歌登录将用户带到Safari登录 下一步 10.6请修改您的应用程序,使用户可以登录或注册应用程序中的帐户 我们建议实现Safari View Controller API以在应用程序

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

来自APPSTORE
我们注意到用户被带到Safari登录或注册帐户,这提供了糟糕的用户体验。具体来说,谷歌登录将用户带到Safari登录

下一步

10.6请修改您的应用程序,使用户可以登录或注册应用程序中的帐户

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

我已经知道了这种拒绝,因为苹果已经拒绝了很多在Safari浏览器中进行登录的应用程序。以下是一些供参考的链接

还有一些你们可以在网上找到的链接

2015年5月,谷歌发布了一款带有原生web视图的新sdk。此处列出了完整的集成过程
它在iOS 8上运行良好,并且还提供了一个控制器

现在我正在使用最新的谷歌sdk,它是我通过CocoaPods安装的
上面来自谷歌的链接有一个我尝试过的iOS登录示例。它现在只在iOS 9中打开一个本机
SFSafariViewController
,但在iOS 8中,登录流再次从应用程序外部转到Safari浏览器

在评论中,apple reviewer要求使用
SafariViewController
,但该控件的可用性来自iOS 9及以上版本。这是链接
如何在iOS 8中使用最新的google sdk实现这一点?
审核人没有提到他/她正在测试的iOS版本


现在有谁能帮我解决这个问题吗。如何在iOS 8中进行管理,iOS 8是谷歌登录页面的本机当前控制器。

最后,通过最新的Google+Sign SDK解决了问题,苹果也批准了该应用程序。我正在发布一个针对iOS 9和iOS 8的解决方案,使用CocoaPods进行集成

pod 'Google/SignIn'
要开始登录,您必须执行与“开始集成”一节中提到的步骤完全相同的步骤

现在在添加登录部分中,我希望在我的自定义类
UIViewController
中有一些自定义按钮来启动登录过程。在谷歌的开发者链接中,他们只在AppDelegate中重定向。因此,为了避免这种情况,我不会在我的
AppDelegate
类中使用
GIDSignInDelegate

我将仅对以下两种
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
class LoginViewController: UIViewController, GIDSignInDelegate, GIDSignInUIDelegate {

}
因此,定义如下:

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
GIDSignInDelegate

//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
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和iOS 9中都能正常工作,而无需将应用程序移到Safari之外,以便在Google+中登录。

@JAL cmon man。这是一个2013年的帖子。情况发生了很大变化。请重新阅读我的问题,并查找SFSAFARIVIEW这个词。为什么不阅读链接的问题呢
SFSafariViewController
仅在iOS 9及更高版本上可用。对于iOS 8及以下版本,您的答案在链接的问题中。@JAL这是apple reviewer实现
SFSafariViewController
的答案。这就是我在《如何使用最新的谷歌sdk克服这个问题》中所提出的全部问题。根据新的SDK,我们现在不使用
GTMOAuth2ViewControllerTouch
。我们甚至在G+登录sdk的API参考列表中没有GPPSignIn。我还提到了谷歌sdk在2015年5月的失败。我现在也遇到了同样的问题,这真的令人沮丧。我正在使用最新的Google登录SDK,但即使在iOS 9中登录Google时,它也不会显示SFSafariViewController。你做了什么特别的事情来打开SFSafariViewController吗?@tyegah123我设法在iOS 9和iOS 8中解决了这个问题,现在这个应用已经上线了。我会很快发布答案。非常感谢!我现在正在尝试。但我很好奇,你的应用程序中是否有谷歌的共享功能或类似功能?因此,你不能使用谷歌登录。你必须使用谷歌共享sdkNah,我也没有使用共享功能。这仅仅是因为即使我使用谷歌登录SDK,苹果也说它是谷歌+SDK,这也是该应用被拒绝的原因之一。所以我想知道你是否在应用程序上使用了某种共享。但无论如何,非常感谢你的帮助。我终于让它在我的应用程序上工作了D@tyegah123apple的google+sdk与登录版相同。伟大的如果这对你有帮助,请投票回答。