Ios GIDSignInButton需要点击两个手指才能启动Google登录流
我正在我的应用程序中实现Google的SignIn SDK,当一切正常时,GIDSignButton需要用两个手指点击才能启动OAuth流 以下是所有相关代码: 在Ios GIDSignInButton需要点击两个手指才能启动Google登录流,ios,swift,google-signin,gidsignin,Ios,Swift,Google Signin,Gidsignin,我正在我的应用程序中实现Google的SignIn SDK,当一切正常时,GIDSignButton需要用两个手指点击才能启动OAuth流 以下是所有相关代码: 在AppDelegate.swift中 func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { return GIDSignIn.sharedInstance().handleURL(
AppDelegate.swift中
func application(app: 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 {
return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation)
}
let googleLoginButton: GIDSignInButton = {
let button = GIDSignInButton()
button.colorScheme = .Light
button.style = .IconOnly
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
var configureError: NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring with Google services: \(configureError)")
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance().uiDelegate = self
view.addSubview(googleLoginButton)
}
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {
if (error == nil) {
// Success
} else {
// Failure
}
}
在LoginViewController.swift中
func application(app: 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 {
return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation)
}
let googleLoginButton: GIDSignInButton = {
let button = GIDSignInButton()
button.colorScheme = .Light
button.style = .IconOnly
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
var configureError: NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring with Google services: \(configureError)")
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance().uiDelegate = self
view.addSubview(googleLoginButton)
}
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {
if (error == nil) {
// Success
} else {
// Failure
}
}
同样,实际的谷歌登录工作,但按钮需要两个手指点击工作。如何使其像普通按钮一样工作(只需要一个手指)?我有一个类似的问题,在我的案例中,是主视图中的点击手势识别器导致了问题,将识别器的取消触摸视图设置为false解决了问题我有一个类似的问题,在我的例子中,是主视图中的点击手势识别器导致了问题,将识别器的取消触摸视图设置为false解决了问题