GoogleSignIn - 始终在IOS 11中返回“用户取消登录流程。”

问题描述 投票:2回答:2

我尝试在我的项目中使用GoogleSignIn,但是在调用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”中,始终出现错误“用户取消了登录流程”。

func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) {}

我在某个地方搜索但是没有得到任何解决方案,感谢阅读,我希望你能帮助我:((

更新1:添加GIDSignInUIDelegate实现

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:显示一些时间警报(图像打击),然后我点击取消,它不能再显示Image here

swift xcode ios11 google-signin
2个回答
3
投票

如果您使用GIDSignInButton,请将其替换为系统的UIButton。这个对我有用。


0
投票

我也有同样的问题。 GIDSignInButton对象在代码中不需要addTarget或链接@IBActionGIDSignInButton班已经为我们处理了这个行动。

© www.soinside.com 2019 - 2024. All rights reserved.