Google登录未返回我的应用

BEM*_*319 5 ios google-signin

我对Google登录无法重定向回我的应用程序有疑问。

我遵循了以下步骤(https://developers.google.com/identity/sign-in/ios/start-integrating),安装了cocoapods,下载了GoogleService-Info.plist(将其添加到我的所有目标中),并添加了URL类型(我的捆绑包标识符,然后是我的反向客户端ID)到达目标,然后逐行执行。

这是plist CFBundleURLTypes的源代码:

    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>MY_REVERSE_CLIENT_ID</string>
        </array>
        <key>CFBundleURLName</key>
        <string>MY_BUNDLE_ID</string>
    </dict>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>MY_BUNDLE_ID</string>
        </array>
        <key>CFBundleURLName</key>
        <string>MY_BUNDLE_ID</string>
    </dict>
Run Code Online (Sandbox Code Playgroud)

在应用程序委托中,我配置了[GGLContext sharedInstance],并在应用程序openURL方法中添加了-

返回[[GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication注解:注释];

如果未安装Google Plus应用,则可以在应用中正常打开safari,一旦登录,委托回调方法将按预期工作。

我相信这是iOS9的问题。以前在iOS8上可以使用。

我还将com-google-gidconsent和com-google-gidconsent-google添加到了我的plist中的LSApplicationQueriesSchemes中,因为我看到另一条帖子说这可能是问题所在。

我检查了在Google Developer Portal中我的捆绑软件ID是否与我项目的捆绑软件ID相匹配,以及客户端ID和反向客户端ID是否正确。

我有三个目标(生产,暂存和测试)。我目前只是在尝试实现生产目标。

我有另一个视图控制器,用户单击google按钮,然后该按钮的操作为[[GIDSignIn sharedInstance] signIn]; 这会将用户带到Google Plus应用并提示用户选择一个帐户。选择帐户后,Google Plus应用程序会询问用户我的应用程序是否可以访问其信息。用户单击“确定”后,将没有回调到我的应用程序。用户只是停留在Google Plus应用中。我在应用程序openURL方法中有一个断点,但它从未命中。

有趣的是,如果我使用反向客户端ID在URL方案中使用com-google-gidconsent-google和com.google.gidconsent配置我的plist,则应用程序openURL方法会被命中,但是

[[GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication注解:注释];

评估为否。

任何帮助将不胜感激。

Vol*_*nov 3

检查您的 application:openURL:sourceApplication:annotation: method 或 application:openURL:options: (取决于您的 AppDelegate 中的哪一个)。应该是为谷歌网址方案实现的类似的东西

return [[GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication annotation:annotation];
Run Code Online (Sandbox Code Playgroud)