公式サイトを参考にFirebaseUIを使用して,ログイン認証を実装したいのですが,cannot find FUITwitterAuth() in scopeとなり,エラーになってしまいます.必要なライブラリはpod installで実行していますが,原因がわからないのでご教示願います.
Podfile
1# Uncomment the next line to define a global platform for your project 2# platform :ios, '9.0' 3 4target 'xxx' do 5 # Comment the next line if you don't want to use dynamic frameworks 6 use_frameworks! 7 8 # Pods for LoveJudgement 9 10 11 pod 'Firebase' 12 pod 'Firebase/Auth' 13 pod 'Firebase/Core' 14 pod 'Firebase/Storage' 15 pod 'Firebase/Firestore' 16 pod 'SDWebImage', '~> 5.0' 17 pod "ViewAnimator" 18 pod 'ActiveLabel' 19 pod 'Charts' 20 pod 'NendSDK_iOS' 21 pod 'NVActivityIndicatorView' 22 pod 'FirebaseUI' 23 24end 25
AppDelegate.swift
1@UIApplicationMain 2class AppDelegate: UIResponder, UIApplicationDelegate { 3 4 5 6 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 7 // Override point for customization after application launch. 8 9 FirebaseApp.configure() 10 return true 11 } 12 13 14//Google ログインまたは Facebook ログインを有効にしている場合は、Google ログインと Facebook ログインのフローの結果を処理するハンドラを実装します。 15 func application(_ app: UIApplication, open url: URL, 16 options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool { 17 let sourceApplication = options[UIApplication.OpenURLOptionsKey.sourceApplication] as! String? 18 if FUIAuth.defaultAuthUI()?.handleOpen(url, sourceApplication: sourceApplication) ?? false { 19 return true 20 } 21 // other URL handling goes here. 22 return false 23 } 24 25 26 // MARK: UISceneSession Lifecycle 27 28 func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 29 // Called when a new scene session is being created. 30 // Use this method to select a configuration to create the new scene with. 31 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 32 } 33 34 func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { 35 // Called when the user discards a scene session. 36 // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 37 // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 38 } 39 40 41}
ViewController.swift
1 2import UIKit 3import Firebase 4import FirebaseAuth 5import FirebaseUI 6 7class ViewController: UIViewController, FUIAuthDelegate { 8 9 10 let authUI = FUIAuth.defaultAuthUI() 11 let providers: [FUIAuthProvider] = [ 12 FUIGoogleAuth(), 13 FUIFacebookAuth(), 14 FUITwitterAuth(), 15 FUIPhoneAuth(authUI:FUIAuth.defaultAuthUI()), 16 ] 17 18 override func viewDidLoad() { 19 super.viewDidLoad() 20 21 authUI?.delegate = self 22 self.authUI?.providers = providers 23 let authViewController = (authUI?.authViewController())! 24 self.present(authViewController, animated: true, completion: nil) 25 26 } 27 func authUI(_ authUI: FUIAuth, didSignInWith user: FIRUser?, error: Error?) { 28 // handle user and error as necessary 29 } 30}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。