Ios 在Google登录弹出框中按“取消”可锁定任何用户交互
我已经为我的应用程序添加了一个自定义的Google登录按钮,但是当我在弹出屏幕上按cancel进行测试时,我得到了Ios 在Google登录弹出框中按“取消”可锁定任何用户交互,ios,swift,google-signin,google-login,Ios,Swift,Google Signin,Google Login,我已经为我的应用程序添加了一个自定义的Google登录按钮,但是当我在弹出屏幕上按cancel进行测试时,我得到了错误登录:Error Domain=com.Google.GIDSignIn code=-5“用户取消了登录流程。”错误消息,然后我的应用程序不再响应。我的AppDelegate.swift文件中确实有以下内容。我还通过我的LoginViewController import UIKit import CoreData import Firebase import GoogleSig
错误登录:Error Domain=com.Google.GIDSignIn code=-5“用户取消了登录流程。”
错误消息,然后我的应用程序不再响应。我的AppDelegate.swift
文件中确实有以下内容。我还通过我的LoginViewController
import UIKit
import CoreData
import Firebase
import GoogleSignIn
import GooglePlaces
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
GMSPlacesClient.provideAPIKey("***********")
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return GIDSignIn.sharedInstance().handle(url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String!, annotation: options[UIApplicationOpenURLOptionsKey.annotation])
}
逻辑视图控制器
@objc func googleLoginTapped(_ sender: UITapGestureRecognizer) {
if NetworkReachabilityManager()!.isReachable {
googleLoginView.isUserInteractionEnabled = false
GIDSignIn.sharedInstance().uiDelegate = self
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance().signIn()
} else {
AlertBox.sendAlert(boxMessage: "Unable to connect to the internet. Please check connectivity before using app", presentingController: self)
}
}
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if let err = error {
print("Error signing in: ", err)
return
}
所以我知道我有URL回拨,但我不知道为什么我的应用程序一直被锁定。在某个时候,你需要这样做
googleLoginView.isUserInteractionEnabled = true
googleLoginView.isUserInteractionEnabled=false。。删除这个…我忘了我在中添加了,以确保用户不会垃圾邮件登录。。。