问题描述
我尝试将视频分享到Facebook,但是当对话框显示的视频没有出现时。
func facebookShare(url: URL){
guard let schemaUrl = URL(string: "fb://") else {
return //be safe
}
if UIApplication.shared.canopenURL(schemaUrl) {
let video = ShareVideo(videoURL: url)
let content = ShareVideoContent()
content.video = video
let dialog = ShareDialog()
dialog.shareContent = content
dialog.delegate = self
dialog.fromViewController = self
dialog.mode = .automatic
dialog.show()
}else {
print("app not installed")
}
}
这是我的图像选择器功能
func imagePickerController(_ picker: UIImagePickerController,didFinishPickingMediawithInfo info: [UIImagePickerController.InfoKey : Any]) {
self.dismiss(animated: true,completion: nil)
videoURL = info[UIImagePickerController.InfoKey.init(rawValue: "UIImagePickerControllerMediaURL")] as? URL
}
解决方法
else if (condition) {
您可以使用一种委托方法来调用对话框视图