アプリに Google の SignIn SDK を実装しています。すべてが機能しますが、OAuth フローを開始するには、GIDSignButton を 2 本の指でタップする必要があります。
関連するすべてのコードは次のとおりです。
の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
}
}
繰り返しますが、実際の Google サインインは機能しますが、ボタンを機能させるには 2 本の指でタップする必要があります。通常のボタンのように機能させるにはどうすればよいですか (指が 1 本しか必要ありません)。