我正在努力让Facebook登录工作,但我认为文档非常混乱和过时。这些都是我所做的步骤。我创建了一个Facebook应用程序,添加了秘密,密钥和OAuth网址。
这是我的Podifle:
platform :ios, '11.0'
target 'App' do
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'FacebookCore'
pod 'FacebookLogin'
end
我已包含此代码
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseConfiguration.shared.setLoggerLevel(.min)
FirebaseApp.configure()
return true
}
这就是应该发生的一切。这是我的LoginViewController
import UIKit
import FacebookLogin
class LoginViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let loginButton = LoginButton(readPermissions: [.publicProfile, .email])
loginButton.center = view.center
view.addSubview(loginButton)
if AccessToken.current() {
// User is logged in, do work such as go to next view controller.
performSegue(withIdentifier: "LoggedIn", sender: nil)
}
}
}
我有2个错误。一个是Use of unresolved identifier 'AccessToken'
,其他人在点击Continue with Facebook
按钮时崩溃。有人可以帮我解决这个问题吗?