我一直在使用Facebook SDK,以便允许用户在我的Swift应用程序中向Facebook分享报价。我的原始(和工作)版本在AppDelegate中使用了以下内容:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
incrementAppRuns()
return true
}
并在相关视图控制器中使用以下内容:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return SDKApplicationDelegate.shared.application(app, open: url, options: options)
}
public func Share(){
let myContent = LinkShareContent(url: URL(string: "https://example.com")!, quote: shareText)
let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .native
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
// Handle share results
}
do {
try shareDialog.show()
}
catch{
}
}
但是,在通过Cocoa Pods将SDK更新到0.7.0之后,编译器现在既不能识别AppDelegate中的SDKApplicationDelegate,也不能识别LinkShareContent
有人知道这是为什么吗?或者我应该做些什么来让它(再次)工作?提前谢谢。我试图查看Facebook的SDK文档,但找不到任何答案。