iOS Facebook分享视频Swift
问题描述:
我正在寻找一种方式在Facebook上分享我的应用程序的视频。 我将SDK安装到了Facebook并按照说明操作,但我不明白为什么我无法分享我的视频。iOS Facebook分享视频Swift
let fbVideo:FBSDKShareVideo = FBSDKShareVideo()
fbVideo.videoURL = url
let content: FBSDKShareVideoContent = FBSDKShareVideoContent()
content.video = fbVideo
FBSDKShareDialog.showFromViewController(self, withContent: content, delegate: self)
我有一个误差参数代表:
Cannot convert value of type 'ShareViewController' to expected argument type 'FBSDKSharingDelegate!'
请注意,我在我的课ShareViewController。
没有其他方法可以在Facebook上分享视频吗?谢谢
答
方法showFromViewController:withContent:delegate:
期望委托参数类型为FBSDKSharingDelegate
。您提供的值类型为ShareViewController
而不是FBSDKSharingDelegate
,这意味着所述视图控制器不符合该类型。您需要使视图控制器符合FBSDKSharingDelegate
类型。举例:
class ShareViewController: UIViewController, FBSDKSharingDelegate {
// code
}
或者传入另一个符合FBSDKSharingDelegate
类型的对象。
感谢您的回答。但是当我尝试实现模块FBSDKSharingDelegate时,我的课程表示她不符合。我没有(据我所知)类型为FBSDKSharingDelegate的对象 –