Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在Google登录弹出框中按“取消”可锁定任何用户交互_Ios_Swift_Google Signin_Google Login - Fatal编程技术网

Ios 在Google登录弹出框中按“取消”可锁定任何用户交互

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

我已经为我的应用程序添加了一个自定义的Google登录按钮,但是当我在弹出屏幕上按cancel进行测试时,我得到了
错误登录: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。。删除这个…我忘了我在中添加了,以确保用户不会垃圾邮件登录。。。