GoogleSignIn-始终返回“用户取消了登录流程."在IOS 11中 [英] GoogleSignIn - Always return "The user canceled the sign-in flow." in IOS 11
问题描述
我尝试在项目中使用GoogleSignIn,但是调用GIDSignIn.sharedInstance().signIn()
I try to use GoogleSignIn in my project, but I have problem when call GIDSignIn.sharedInstance().signIn()
我在下面收到警告:
[Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFAuthenticationViewController: 0x7fccba008c00>)
在"GIDSignInDelegate"中,始终出现错误用户取消了登录流程."
And in "GIDSignInDelegate", always had error "The user canceled the sign-in flow."
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) {}
我在某处进行搜索,但无法解决此问题,感谢您的阅读,希望您对我有所帮助:((
I searched on somewhere but could not got any solutions for this case, thanks for reading, I hope you will help me :((
更新1:添加GIDSignInUIDelegate实现
UPDATE 1: add GIDSignInUIDelegate implementation
extension MyClass: GIDSignInUIDelegate {
func sign(inWillDispatch signIn: GIDSignIn!, error: Error!) {
print(#function)
}
func sign(_ signIn: GIDSignIn!, present viewController: UIViewController!) {
print(#function)
self.present(viewController, animated: true, completion: nil)
}
func sign(_ signIn: GIDSignIn!, dismiss viewController: UIViewController!) {
print(#function)
self.dismiss(animated: true, completion: nil)
}
}
并且我收到以下消息:
[Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFAuthenticationViewController: 0x103023800>)
更新2:显示一些时间警报(在图像打击中),然后我点击取消",但无法再次显示此处的图片
UPDATE 2: Some time alert (in image blow) is shown, then I tap on cancel and it can not shown again Image here
推荐答案
如果使用GIDSignInButton
,请将其替换为系统的UIButton
.它对我有用.
if you use GIDSignInButton
, replace it with the system's UIButton
. It works for me.
这篇关于GoogleSignIn-始终返回“用户取消了登录流程."在IOS 11中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!