Kru*_*ala 12 swift fbsdk fbsdkloginkit
我安装了两个用于Facebook登录的广告连播
pod 'FacebookCore'
pod 'FacebookLogin'
Run Code Online (Sandbox Code Playgroud)
而不是在appdelegate中导入FacebookCore。它仍然显示使用未解决的标识符错误。
我还在info.plist中实现了标签
<array>
<string>fb---------</string>
</array>
<key>FacebookAppID</key>
<string>-----------</string>
<key>FacebookDisplayName</key>
<string>-----------</string>
Run Code Online (Sandbox Code Playgroud)
仍然无法获取SDKApplicationDelegate。
func application(_ app: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
if SDKApplicationDelegate.shared.application(app, open: url, options: options) {
return true
}
return false
}
Run Code Online (Sandbox Code Playgroud)
Win*_*ngs 27
其原因SDKApplicationDelegate是更改为ApplicationDelegate
func application(_ app: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
if ApplicationDelegate.shared.application(app, open: url, options: options) {
return true
}
return false
}
Run Code Online (Sandbox Code Playgroud)
还有一件事要做
class AppDelegate: UIResponder, UIApplicationDelegate
Run Code Online (Sandbox Code Playgroud)
同时导入这两个Pod
import FBSDKCoreKit
import FBSDKLoginKit
Run Code Online (Sandbox Code Playgroud)
只需替换SDKApplicationDelegate为ApplicationDelegate
import FacebookCore
//....
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
//....
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
guard let urlScheme = url.scheme else { return false }
if urlScheme.hasPrefix("fb") {
return ApplicationDelegate.shared.application(app, open: url, options: options)
}
return true
}
Run Code Online (Sandbox Code Playgroud)