Swift 3 - 将视频文件上传到Facebook

时间:2018-01-14 18:47:37

标签: swift facebook facebook-graph-api video share

我如何从本地目录向facebook分享视频文件。

let dataTs: Data?

我尝试使用其他解决方案,但它们不起作用

        var videoData: Data
        do {
            videoData = ServerManager.sharedManager.dataTs
            print(videoData)
            var strDesc : String
            strDesc = "test Description"
            let videoObject: [String : Any] = ["title": "Millions Poet", "description": strDesc]
            let uploadRequest: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me/videos", parameters: videoObject, httpMethod: "POST")
            uploadRequest.start(completionHandler: {(connection: FBSDKGraphRequestConnection, result: AnyObject, error: NSError) -> Void in
                if error == error {
                    NSLog("Error")
                } else {
                    NSLog("Success")
                }

                } as! FBSDKGraphRequestHandler)
        } catch {
            print(error)
        }

1 个答案:

答案 0 :(得分:1)

Swift 3代码

Relationship