我正在我的应用程序中实现 Google 的 SignIn SDK,虽然一切正常,但 GIDSignButton 需要两根手指点击才能启动 OAuth 流程。
以下是所有相关代码:
在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)
}
在LoginViewController.swift
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
}
}
同样,实际的谷歌登录工作,但该按钮需要两指点击才能工作。我怎样才能让它像普通按钮一样工作(只需要一根手指)?