我正在寻找一种在 Facebook 上分享我的申请视频的方法。 我将 SDK 安装到 facebook 并按照说明操作,但我不明白为什么我不能分享我的视频。
let fbVideo:FBSDKShareVideo = FBSDKShareVideo()
fbVideo.videoURL = url
let content: FBSDKShareVideoContent = FBSDKShareVideoContent()
content.video = fbVideo
FBSDKShareDialog.showFromViewController(self, withContent: content, delegate: self)
我有一个关于参数委托(delegate)的错误:
Cannot convert value of type 'ShareViewController' to expected argument type 'FBSDKSharingDelegate!'
请注意,我在我的类(class) ShareViewController 中。
没有其他方法可以在 Facebook 上分享视频吗?谢谢
最佳答案
showFromViewController:withContent:delegate:
方法期望委托(delegate)参数的类型为 FBSDKSharingDelegate
。您提供的值类型为 ShareViewController
而不是 FBSDKSharingDelegate
这意味着所述 View Controller 不符合该类型。您需要使您的 View Controller 符合 FBSDKSharingDelegate
类型。例如:
class ShareViewController: UIViewController, FBSDKSharingDelegate {
// code
}
或者传入另一个符合类型FBSDKSharingDelegate
的对象。
关于iOS Facebook 分享视频 Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39562564/