質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Q&A

解決済

1回答

693閲覧

【Firebase】FirebaseUIを使った認証でメール認証が入ってない

nakamu

総合スコア82

Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

0グッド

0クリップ

投稿2019/03/17 09:59

編集2019/03/17 10:05

メールアドレスの認証が表示されません
謎です。

イメージ説明
イメージ説明

Swift

1import UIKit 2import Firebase 3import FirebaseUI 4 5@UIApplicationMain 6class AppDelegate: UIResponder, UIApplicationDelegate { 7 8 var window: UIWindow? 9 10 override init() { 11 super.init() 12 FirebaseApp.configure() 13 } 14 15 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 // Override point for customization after application launch. 17 // Use Firebase library to configure APIs 18// FirebaseApp.configure() 19 return true 20 } 21 22 // facebook&Google&電話番号認証時に呼ばれる関数 23 func application(_ app: UIApplication, open url: URL, 24 options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool { 25 let sourceApplication = options[UIApplication.OpenURLOptionsKey.sourceApplication] as! String? 26 // GoogleもしくはFacebook認証の場合、trueを返す 27 if FUIAuth.defaultAuthUI()?.handleOpen(url, sourceApplication: sourceApplication) ?? false { 28 return true 29 } 30 // other URL handling goes here. 31 return false 32 } 33 34 func applicationWillResignActive(_ application: UIApplication) { 35 // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 36 // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 37 } 38 39 func applicationDidEnterBackground(_ application: UIApplication) { 40 // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 41 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 42 } 43 44 func applicationWillEnterForeground(_ application: UIApplication) { 45 // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 46 } 47 48 func applicationDidBecomeActive(_ application: UIApplication) { 49 // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 50 } 51 52 func applicationWillTerminate(_ application: UIApplication) { 53 // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 54 } 55 56 57}

Swift

1import UIKit 2import Firebase 3import FirebaseUI 4 5class RootTabBarController: UITabBarController, FUIAuthDelegate, UITabBarControllerDelegate { 6 7 var authUI = FUIAuth.defaultAuthUI()! 8 9 let providers: [FUIAuthProvider] = [ 10 FUIGoogleAuth(), 11 FUIPhoneAuth(authUI:FUIAuth.defaultAuthUI()!), 12 ] 13 14 override func viewDidLoad() { 15 super.viewDidLoad() 16 UITabBar.appearance().shadowImage = UIImage() 17 UITabBar.appearance().backgroundImage = UIImage() 18 19 self.delegate = self 20 21 // authUIのデリゲート 22 self.authUI.delegate = self 23 self.authUI.providers = providers 24 25 } 26 27 func checkLoggedIn() -> Bool { 28 var authCheck = false 29 Auth.auth().addStateDidChangeListener{auth, user in 30 if user != nil{ 31 //サインインしている 32 authCheck = true 33 } else { 34 //サインインしていない 35 self.login() 36 } 37 } 38 return authCheck 39 } 40 41 42 43 func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { 44 print("ああああああ") 45 if viewController is HomeViewController { 46// return false 47 } else { 48 return checkLoggedIn() 49 } 50 return true 51 } 52 53 // 認証画面から離れたときに呼ばれる(キャンセルボタン押下含む) 54 public func authUI(_ authUI: FUIAuth, didSignInWith user: User?, error: Error?){ 55 // 認証に成功した場合 56 if error == nil { 57 self.performSegue(withIdentifier: "toTopView", sender: self) 58 } 59 // エラー時の処理をここに書く 60 } 61 62 func login() { 63 // FirebaseUIのViewの取得 64 let authViewController = self.authUI.authViewController() 65 // FirebaseUIのViewの表示 66 self.present(authViewController, animated: true, completion: nil) 67 } 68 69} 70

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

swift

1let providers: [FUIAuthProvider] = [ 2 FUIGoogleAuth(), 3 FUIPhoneAuth(authUI:FUIAuth.defaultAuthUI()!), 4]

上記コードにメール認証用のproviderが追加されていないためと思います。

投稿2019/03/19 10:17

kakajika

総合スコア3131

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

nakamu

2019/03/20 10:14

おっしゃる通りGitHubに詳しく書いてあり助かりました。 kakajikaさんありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問