ios - Video upload with FacebookSDK -
i'm trying upload video file ios facebooks graphapi. sadly it's not working expected. although this says local .mov should supported, im getting following error:
error: error domain=com.facebook.sdk.core code=8 "the operation couldn’t completed. (com.facebook.sdk.core error 8.)" userinfo=0x161a2f30 {com.facebook.sdk:fbsdkgraphrequesterrorgrapherrorcode=352, com.facebook.sdk:fbsdkgraphrequesterrorparsedjsonresponsekey={ body = { error = { code = 352; message = "(#352) sorry, video file selected in format don't support."; type = oauthexception; }; }; code = 400; }, com.facebook.sdk:fbsdkgraphrequesterrorhttpstatuscodekey=400, com.facebook.sdk:fbsdkerrordevelopermessagekey=(#352) sorry, video file selected in format don't support., com.facebook.sdk:fbsdkgraphrequesterrorcategorykey=0} my code follows:
//outlet 4 picking movie file photolibrary @ibaction func sharevideo(sender: uibutton) { if uiimagepickercontroller.issourcetypeavailable(uiimagepickercontrollersourcetype.photolibrary){ println("video capture") imagepicker.delegate = self imagepicker.sourcetype = uiimagepickercontrollersourcetype.photolibrary imagepicker.allowsediting = false imagepicker.mediatypes = [kuttypemovie] self.presentviewcontroller(imagepicker, animated: true, completion: nil) } } func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) { println(info) //stoping imagepickerview imagepicker.dismissviewcontrolleranimated(true, completion: nil) var videodatei : nsdata = nsdata(contentsofurl: info[uiimagepickercontrollermediaurl] as! nsurl)! var params : nsdictionary = ["source" : videodatei ] var token = fbsdkaccesstoken.currentaccesstoken().tokenstring var videorequest : fbsdkgraphrequest = fbsdkgraphrequest(graphpath: "me/videos", parameters: params [nsobject : anyobject], tokenstring: token, version: nil, httpmethod: "post") videorequest.startwithcompletionhandler({ (connection, result, error) -> void in if ((error) != nil) { // process error println("error: \(error)") } else { println(result) } }) } facebooksdk documentation doesn't give example code videoupload apart from
nsdictionary *params = @{ @"source": @"{video-data}", }; and sending request, no information on {video-data} apart "multipart/form-data" don't understand.
info: ios 8.3 swift facebooksdk v.4.1.0 fbsdk graphapi v.2.3
thanks time, rolf
Comments
Post a Comment