我正在视图控制器上实现Swift中的firebase google登录。实施后我收到了权限提示警报,但是一旦点击继续警报就没有发生任何事情只是关闭警报视图。 Facebook登录也是如此。有什么想法吗?
提前致谢
的AppDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
GIDSignIn.sharedInstance().delegate = self
// Override point for customization after application launch.
return true
}
的ViewController
override func viewDidLoad() {
GIDSignIn.sharedInstance().uiDelegate = self
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) {
// ...
if let error = error {
// ...
return
}
guard let authentication = user.authentication else { return }
let credential = GoogleAuthProvider.credential(withIDToken: authentication.idToken,
accessToken: authentication.accessToken)
// ...
}
@IBAction func signInClick(_ sender: Any) {
GIDSignIn.sharedInstance().signIn()
}
在做了一些调试之后我发现在点击继续之后,它试图调用SFSafariViewController,但是没有显示SafariViewController。
截图