如何通过iOS上的Google登录功能解决“用户取消了登录流程."? [英] How to fix `The user canceled the sign-in flow.` with Sign In with Google on iOS?
问题描述
我正在使用iOS Firebase SDK集成Google登录.当用户点击GIDSignIn
按钮时,应用程序会显示一个警报,其中显示"MyAPP" want to use Google.com for Sign in
,但是该警报很快就会消失.我在didSignInFor user: GIDGoogleUser
方法中遇到的错误如下:
I am integrating Sign in with Google with iOS Firebase SDK. When a user taps on the GIDSignIn
button, the app shows an alert showing "MyAPP" want to use Google.com for Sign in
, but the alert dismisses quickly. The error I get in the didSignInFor user: GIDGoogleUser
method as follows:
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.}
我已遵循在iOS上使用Google登录进行身份验证文档.
我还尝试在在iOS 9上尝试调用canOpenURL的Google登录崩溃崩溃的答案,但事实并非如此.工作.
I also tried the answer at Google Sign-In crashes on iOS 9 attempting to call canOpenURL, but it is not working.
AppDelegate
也实现了GIDSignInUIDelegate
.
如果我将按钮从 GIDSignInButton
更改为UIButton
,它会起作用,但是样式会丢失.
If I change the button from GIDSignInButton
to UIButton
, it works, but the style is lost.
推荐答案
我之前也遇到过这个问题. GIDSignInButton
对象不需要代码或链接@IBAction
中的addTarget
. GIDSignInButton
类已经为我们处理了该操作.
I also faced the issue before. The GIDSignInButton
object don't need addTarget
in code or linking @IBAction
. The GIDSignInButton
class already handle that action for us.
这篇关于如何通过iOS上的Google登录功能解决“用户取消了登录流程."?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!