Google Sign In Button does Nothing

Quick, Easy Solution:

Steps:

  1. Extend to UIGestureRecognizerDelegate
  2. Paste in the following methods
  3. add dismissOnTap() to your view controller

Code:

class ViewController: UIViewController, UIGestureRecognizerDelegate {

 override func viewDidLoad() {
        super.viewDidLoad()

        // Call dismissOnTap
        dismissOnTap()

 }

 func dismissOnTap() {
        self.view.isUserInteractionEnabled = true
        let tap = UITapGestureRecognizer(target: self, action: Selector("dismissKeyboard"))
        tap.delegate = self
        tap.cancelsTouchesInView = false
        self.view.addGestureRecognizer(tap)
 }

    func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
        if touch.view is GIDSignInButton {
            return false
        }
        return true
    }

    func dismissKeyboard() {
        self.view.endEditing(true)
    }

}

I have figured it out, would like to let anyone else know this stupid stupid issue!

The problem is with the Google button and the tap I have to dismiss the keyboard. I didn't put it on here, but here it is.

let tap = UITapGestureRecognizer(target: self, action: #selector(LoginViewController.dismissKeyboard))
self.view.addGestureRecognizer(tap)

func dismissKeyboard() {
    self.view.endEditing(true)
}

Google's Delegates mess this up for some reason. I haven't come up with a solution yet, as I literally just now found the issue, but if anyone else has an issue, I hope this helps!


I had the same issue and that was a problem with a tap gesture recognizer that was bound to the main view in order to dismiss keyboard. It was accidentally capturing also the touches inside the GIDSignInButton. Changing this setting helped:

tapGesture.cancelsTouchesInView = false