impression7vx impression7vx - 1 year ago 103
iOS Question

Google Sign In Button does Nothing

I have implemented the Google Sign In exactly as Google states to according to their website. I had it working about a month ago, now it just does nothing. I tried to redo everything by deleting the cocoapod and following their website to a T but nothing is happening still. It is like none of the delegate methods are being called, and I am unsure why. Any help would be appreciative. Thanks!

import GoogleSignIn
import Google
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

//Get Twitter and set Twitter keys for Application
Twitter.sharedInstance().startWithConsumerKey("uBedaxDuMDgImGbjun1oYf0ay", consumerSecret: "OaKqBZUesX5CypHCwrTvTZE22jrXIuRsUeZzVaMHej11R5Vh3b")

// Initialize sign-in GOOGLE
var configureError: NSError?
assert(configureError == nil, "Error configuring Google services: \(configureError)")

GIDSignIn.sharedInstance().delegate = self

return true

func application(application: UIApplication,
openURL url: NSURL, options: [String: AnyObject]) -> Bool {
return GIDSignIn.sharedInstance().handleURL(url,
sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String,
annotation: options[UIApplicationOpenURLOptionsAnnotationKey])

func application(application: UIApplication,
openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
var options: [String: AnyObject] = [UIApplicationOpenURLOptionsSourceApplicationKey: sourceApplication!,
UIApplicationOpenURLOptionsAnnotationKey: annotation!]
return GIDSignIn.sharedInstance().handleURL(url,
sourceApplication: sourceApplication,
annotation: annotation)

func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!,
withError error: NSError!) {
print("SIGNING IN")
if (error == nil) {
let email =
// ...
} else {
print("ERROR = \(error.localizedDescription)")

View Controller

import GoogleSignIn
class LoginViewController: UIViewController, UITextFieldDelegate, CLLocationManagerDelegate, GIDSignInUIDelegate
override func viewDidLoad() {

//Default setup for View Controller

GIDSignIn.sharedInstance().uiDelegate = self
var error:NSError?
if(error != nil) {

var signInButton = GIDSignInButton(frame: CGRect(x: 0, y: 0, width: 150, height: 400))



After HOURS, lol, of figuring this out, the Google Sign-In Button works when it is
1)Held down for more than 2 seconds,
2)Swiped left/down/right but not up
I am unsure of this cause and would be open to suggestions! Thanks!

Answer Source

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))

func dismissKeyboard() {

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!