【问题标题】:How to share video on Facebook in Swift?如何使用 Swift 在 Facebook 上分享视频?
【发布时间】:2021-01-23 01:31:45
【问题描述】:

我尝试将视频分享到 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
}

【问题讨论】:

    标签: ios swift facebook share fbsdk


    【解决方案1】:
    [FBSDKShareDialog showFromViewController:withContent:delegate:]
    

    您可以使用一种委托方法来调用对话框视图

    【讨论】:

      猜你喜欢
      • 2017-01-26
      • 2020-05-28
      • 2012-04-19
      • 1970-01-01
      • 1970-01-01
      • 2015-10-18
      • 2013-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多