ios - 如何在 iOS 上使用 Sign In with Google 修复 `The user canceled the sign-in flow.`?

标签 ios swift google-signin

我正在将 Sign in with Google 与 iOS Firebase SDK 集成。当用户点击 GIDSignIn 按钮时,应用程序会显示一条警告,显示 “MyAPP”想要使用 Google.com 登录,但警告很快就会消失。我在 didSignInFor user: GIDGoogleUser 方法中得到的错误如下:

2019-02-21 16:54:13.104279+0530 MyApp[18743:185089] [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFAuthenticationViewController: 0x7fa327945800>)
[DEBUG] Google sign-in error: Error Domain=com.google.GIDSignIn Code=-5 "The user canceled the sign-in flow." UserInfo={NSLocalizedDescription=The user canceled the sign-in flow.}

我已经关注了 Authenticate Using Google Sign-In on iOS文档。

我也在 Google Sign-In crashes on iOS 9 attempting to call canOpenURL 尝试了答案, 但它不起作用。

AppDelegate 也实现了 GIDSignInUIDelegate

如果我将按钮从 GIDSignInButton to UIButton 更改为, 它有效,但风格丢失了。

最佳答案

我之前也遇到过这个问题。 GIDSignInButton 对象在代码中不需要addTarget 或链接@IBActionGIDSignInButton 类已经为我们处理了该操作。

关于ios - 如何在 iOS 上使用 Sign In with Google 修复 `The user canceled the sign-in flow.`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54806794/

相关文章:

c# - 调用 Facebook/Google+ 时 ExternalLogin 未命中

ios - Google 和 Facebook 在同一个应用程序中登录

ios - WKWebView iOS 中的 Google 登录按钮没有响应

ios - 任何设备的 Storyboard 安全区域错误/固定宽度

ios - 通过2个关系搜索核心数据

ios - 如何理解,调试这部分

ios - 应用程序在 iOS 8.1.3 上崩溃,无法重现问题

ios - Swift - 如何隐藏未知按钮?

swift - 在 UITextView 中切换 selectedRange 属性

ios - 由于 Swift 中的空值,For 循环未执行