I want to upload video on facebook using ios-sdk
I check discussion in question iPhone Facebook Video Upload and try to implement it in my application
I try to
See the comments in FBVideoUpload.h:
Please note that this code parses the access token from the Facebook class, which is quite brittle, unofficial and could easily break with the upcoming SDK releases. Also it seems to only work with the older, pop-up authentication and not the new one that uses app switching. (The new authentication scheme seems to result in a different auth token format that we can’t parse.)
Your problem looks like you are using the modern, app-switching authentication scheme. That results in a different access token and therefore the video uploading hack does not work. Switching to the older authentication scheme is easy, see code in this branch (it adds a forceOldStyleAuth
property to the Facebook
class).
As for the dictionary to pass with the upload, here’s how my code looks:
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"Sample video title", @"title",
@"Sample video description", @"description",
nil];
upload = [[FBVideoUpload alloc] init];
[upload setApiKey:kAPIKey];
[upload setAccessToken:facebook.accessToken];
[upload setAppSecret:kAppSecret];
[upload startUploadWithURL:movieURL params:params delegate:self];
This works for me.
The privacy dictionary entry format changed:
NSDictionary * params = [NSDictionary dictionaryWithObjectsAndKeys:
@"Sample video title", @"title",
@"Sample video description", @"description",
@"{\"value\": \"ALL_FRIENDS\"}", @"privacy",
nil];
The Graph API docs for the Post object talk about the privacy object: http://developers.facebook.com/docs/reference/api/post/
But that doesn't fix the video not showing up in "My Videos" or even allow my friends to see it if they have the direct link. The Share button on the video page is broken too, so I can't even get it posted to my wall that way.