xcodeでGIDSignInButtonがConnectできません。
https://developers.google.com/identity/sign-in/ios/sign-in?ver=swift
のサイトの通り実施していますが、以下の状況です。
ViewControllerのコード
swift
1import UIKit 2 3class ViewController: UIViewController, GIDSignInUIDelegate { 4 5 @IBOutlet weak var signInButton: GIDSignInButton! 6 @IBOutlet weak var signInButton2: UIButton! 7 8 override func viewDidLoad() { 9 super.viewDidLoad() 10 GIDSignIn.sharedInstance().uiDelegate = self 11 } 12 13 func sign(inWillDispatch signIn: GIDSignIn!, error: Error!) { 14 //myActivityIndicator.stopAnimating() 15 } 16 17 func sign(_ signIn: GIDSignIn!, 18 present viewController: UIViewController!) { 19 self.present(viewController, animated: true, completion: nil) 20 } 21 22 func sign(_ signIn: GIDSignIn!, 23 dismiss viewController: UIViewController!) { 24 self.dismiss(animated: true, completion: nil) 25 } 26 27 @IBAction func didTapSignOut(sender: AnyObject) { 28 GIDSignIn.sharedInstance().signOut() 29 } 30 31 override func didReceiveMemoryWarning() { 32 super.didReceiveMemoryWarning() 33 } 34}
StoryBoardでsignInButton2のUIButtonは通常通りコネクトできます。
signInButtonのGIDSignInButtonはコネクトできません。
何か考えられる原因をアドバイスください。
ここまでのコンパイルはできています。
AppDelegateは以下の通りです。
swift
1import UIKit 2import Google 3 4@UIApplicationMain 5class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate { 6 var window: UIWindow? 7 8 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 9 return true 10 } 11 12 func applicationWillResignActive(_ application: UIApplication) { 13 } 14 15 func applicationDidEnterBackground(_ application: UIApplication) { 16 } 17 18 func applicationWillEnterForeground(_ application: UIApplication) { 19 } 20 21 func applicationDidBecomeActive(_ application: UIApplication) { 22 } 23 24 func applicationWillTerminate(_ application: UIApplication) { 25 } 26 27 private func application(application: UIApplication, 28 didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 29 // Initialize sign-in 30 var configureError: NSError? 31 GGLContext.sharedInstance().configureWithError(&configureError) 32 assert(configureError == nil, "Error configuring Google services: (String(describing: configureError))") 33 GIDSignIn.sharedInstance().delegate = self 34 return true 35 } 36 37 @available(iOS 9.0, *) 38 func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) 39 -> Bool { 40 return GIDSignIn.sharedInstance().handle(url, 41 sourceApplication:options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, 42 annotation: [:]) 43 } 44 45 //for iOS 8, check availability 46 @available(iOS, introduced: 8.0, deprecated: 9.0) 47 func application(application: UIApplication,openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { 48 return GIDSignIn.sharedInstance().handle(url as URL!, sourceApplication: sourceApplication!, annotation: annotation) 49 } 50 51 func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) { 52 if (error == nil) { 53 // Perform any operations on signed in user here. 54 let userId = user.userID // For client-side use only! 55 let idToken = user.authentication.idToken // Safe to send to the server 56 let fullName = user.profile.name 57 let givenName = user.profile.givenName 58 let familyName = user.profile.familyName 59 let email = user.profile.email 60 // ... 61 } else { 62 print("(error.localizedDescription)") 63 } 64 } 65 66 func signIn(signIn: GIDSignIn!, didDisconnectWithUser user:GIDGoogleUser!, 67 withError error: NSError!) { 68 // Perform any operations when the user disconnects from app here. 69 // ... 70 } 71}
よろしくお願いします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/12/28 04:23