前提・実現したいこと
SwiftでFirebaseを使ってTwitterログイン機能を作りたいのですが、
デバックをしたところで「No such module 'FirebaseUI'」になってしまいます。
'FirebaseUI'はインストールされてるはずなのですが、
TwitterのAPIKEYなども取得して、ソースに記載しています。
以下のサイトを参考に作成しています。
https://qiita.com/matsuei/items/4f56c0f8d9a1b96cd9f0
ご教授頂ければと思います。
発生している問題・エラーメッセージ
No such module 'FirebaseUI'
該当のソースコード
ViewController.swift
swift
1import UIKit 2import Firebase 3import FirebaseUI 4 5class ViewController: UIViewController,FUIAuthDelegate { 6 7 @IBOutlet weak var AuthButton: UIButton! 8 9 var authUI: FUIAuth { get { return FUIAuth.defaultAuthUI()!}} 10 // 認証に使用するプロバイダの選択 11 let providers: [FUIAuthProvider] = [ 12 FUITwitterAuth(), 13 ] 14 15 override func viewDidLoad() { 16 super.viewDidLoad() 17 // authUIのデリゲート 18 self.authUI.delegate = self 19 self.authUI.providers = providers 20 AuthButton.addTarget(self,action: #selector(self.AuthButtonTapped(sender:)),for: .touchUpInside) 21 } 22 23 @objc func AuthButtonTapped(sender : AnyObject) { 24 // FirebaseUIのViewの取得 25 let authViewController = self.authUI.authViewController() 26 // FirebaseUIのViewの表示 27 self.present(authViewController, animated: true, completion: nil) 28 } 29 30 // 認証画面から離れたときに呼ばれる(キャンセルボタン押下含む) 31 public func authUI(_ authUI: FUIAuth, didSignInWith user: User?, error: Error?){ 32 // 認証に成功した場合 33 if error == nil { 34 self.performSegue(withIdentifier: "toTopView", sender: self) 35 } 36 // エラー時の処理をここに書く 37 } 38} 39
↓AppDelegate.swift
swift
1import UIKit 2import Firebase 3import FirebaseUI 4import TwitterKit 5 6@UIApplicationMain 7class AppDelegate: UIResponder, UIApplicationDelegate { 8 9 var window: UIWindow? 10 11 override init() { 12 super.init() 13 // Firebase関連の機能を使う前に必要 14 FirebaseApp.configure() 15 } 16 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 //Twitter認証用のイニシャライズ 18 TWTRTwitter.sharedInstance().start(withConsumerKey:"XXXXX",consumerSecret:"XXXXX") 19 return true 20 } 21 22// func application(_ application: UIApplication, 23// didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) 24// -> Bool { 25// FirebaseApp.configure() 26// return true 27// } 28 29 func applicationWillResignActive(_ application: UIApplication) { 30 // 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. 31 // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 32 } 33 34 func applicationDidEnterBackground(_ application: UIApplication) { 35 // 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. 36 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 37 } 38 39 func applicationWillEnterForeground(_ application: UIApplication) { 40 // 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. 41 } 42 43 func applicationDidBecomeActive(_ application: UIApplication) { 44 // 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. 45 } 46 47 func applicationWillTerminate(_ application: UIApplication) { 48 // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 } 50 51 52} 53
Podfileは以下のように書いています。
# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'SwiftTest01' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for SwiftTest01 pod 'Firebase/Database' #pod 'MessageKit', '>= 1.0.0' #pod 'MessageKit' pod 'JSQMessagesViewController' #pod 'MessageInputBar' pod 'FirebaseUI' pod 'Firebase/Core' end
補足情報(FW/ツールのバージョンなど)
バージョンswift4
回答2件
あなたの回答
tips
プレビュー