firebaseを用いてfacebookログインを実装しようとしています。
とある講座の教材として実装しているのですが、
cocoapodsで下記ライブラリをinstallし、
ruby
1# Uncomment the next line to define a global platform for your project 2# platform :ios, '9.0' 3 4target 'Swift5FacebookLoginWithFirebase_3' do 5 # Comment the next line if you don't want to use dynamic frameworks 6 use_frameworks! 7 8 # Pods for Swift5FacebookLoginWithFirebase_3 9 pod 'Firebase/Auth' 10 pod 'FacebookSDK' 11 pod 'Firebase/Core' 12 pod 'FacebookCore' 13 pod 'FacebookLogin' 14 pod 'FacebookShare' 15 pod 'SDWebImage/WebP' 16 17end 18```swift 19 20viewControllerにて、 21下記のように 22importしていますが、下記画像のようにFBSDKCoreKItがNo such module~となります。 23なぜでしょうか? 24 25![イメージ説明](ba9c0ca4727a382b8f50609209aba1f3.png) 26
import UIKit
import FBSDKCoreKit
import FBSDKLoginKit
import FacebookCore
import FacebookLogin
import Firebase
class ViewController: UIViewController, LoginButtonDelegate {
let fbLoginButton: FBLoginButton = FBLoginButton() var displayName = String() var pictureURL = String() var pictureURLString = String() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. fbLoginButton.delegate = self fbLoginButton.frame = CGRect(x: view.frame.size.width/2 - view.frame.size.width, y: view.frame.size.width/4, width: view.frame.size.height/2, height: 30) fbLoginButton.permissions = ["public_profile,email"] view.addSubview(fbLoginButton) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.isNavigationBarHidden = true } func loginButton(_ loginButton: FBLoginButton, didCompleteWith result: LoginManagerLoginResult?, error: Error?) { if error == nil { if result?.isCancelled == true { return } } let credential = FacebookAuthProvider.credential(withAccessToken: AccessToken.current!.tokenString) Auth.auth().signIn(with: credential) { (result, errror) in if let error = error{ return } self.displayName = result!.user.displayName! self.pictureURLString = result!.user.photoURL!.absoluteString UserDefaults.standard.set(1, forKey: "loginOK") UserDefaults.standard.set(self.displayName, forKey: "displayName") UserDefaults.standard.set(self.pictureURLString, forKey: "pictureURLString") } } func loginButtonDidLogOut(_ loginButton: FBLoginButton) { <#code#> }
// //github試験用
// func Log() {
// print("gittest")
// }
//
// //さらに変更
// func Log2() {
// print("gittest")
// }
}
pod install で下記のようにwarningがでます。 ちなみに、rbenvでrubyを2.7.0に最近しました。関係があるのでしょうか?
Analyzing dependencies
/Users/eishunsudo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/cdn_source.rb:342: warning: URI.escape is obsolete
(以下同様)
/Users/eishunsudo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/cdn_source.rb:342: warning: URI.escape is obsolete
Downloading dependencies
Generating Pods project
/Users/eishunsudo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nanaimo-0.2.6/lib/nanaimo/writer/pbxproj.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/eishunsudo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nanaimo-0.2.6/lib/nanaimo/writer.rb:35: warning: The called method `initialize' is defined here
Integrating client project
/Users/eishunsudo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/cdn_source.rb:342: warning: URI.escape is obsolete
Pod installation complete! There are 7 dependencies from the Podfile and 23 total pods installed.
コード
あなたの回答
tips
プレビュー