Q&A
swift4
xcode9.2
FirebaseAuthでのGoogleログインは
デバッグエリアを見る限り成功している様ですが、
シミュレーター上でGoogleLogInボタンをタップしても、
上記画像の様なgmailアドレスとパスワードを入力する画面が立ち上がってきません。
FirebaseAuthのユーザータブから認証した(ログインした)アカウントを削除し、
再度GoogleLogInボタンをタップしても
画面は立ち上がってきません。
どうすればgoogleログイン画面を表示できますか?
教えて頂きたいです。
(AppDelegateです) import UIKit import Firebase import FirebaseAuth import GoogleSignIn import FBSDKCoreKit import RAMAnimatedTabBarController @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { print("アプリ起動時の処理だよ") FirebaseApp.configure() GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID GIDSignIn.sharedInstance().delegate = self return true } func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) { func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { return GIDSignIn.sharedInstance().handle(url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplicationOpenURLOptionsKey.annotation]) } } func applicationWillResignActive(_ application: UIApplication) { print("アプリ閉じそう") } func applicationDidEnterBackground(_ application: UIApplication) { print("アプリ閉じた") } func applicationWillEnterForeground(_ application: UIApplication) { print("アプリ開きそう") } func applicationDidBecomeActive(_ application: UIApplication) { print("アプリ開いた") FBSDKAppEvents.activateApp() } func applicationWillTerminate(_ application: UIApplication) { print("フリックしてアプリ終了") } }
(LogInViewControllerです) import UIKit import Firebase import FirebaseAuth import GoogleSignIn import FBSDKCoreKit import FBSDKLoginKit import RAMAnimatedTabBarController class LogInViewController: UIViewController, GIDSignInUIDelegate { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. GIDSignIn.sharedInstance().uiDelegate = self GIDSignIn.sharedInstance().signIn() } @IBAction func GIDLigInButton(_ sender: Any) { func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) { if let error = error { print(error.localizedDescription) return } print("User signed into google") guard let authentication = user.authentication else { return } let credential = GoogleAuthProvider.credential(withIDToken: (authentication.idToken)!, accessToken: (authentication.accessToken)!) Auth.auth().signIn(with: credential) { (user, error) in if let error = error { print(error.localizedDescription) return } print("サクセスFirebase") let storyboard: UIStoryboard = UIStoryboard(name: "RAMAnimatedTabBar", bundle: nil) let nextView = storyboard.instantiateInitialViewController() as! RAMAnimatedTabBarController self.present(nextView, animated: true, completion: nil) } } } /* StoryboadでMailSignUpToFirstViewを引くため(戻るため)に必要 ボタン 戻る際の処理が特に必要ないのでメソッドは空です*/ func BackLogInView(segue: UIStoryboardSegue) { } }
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。