I have an app that posts native (MOV files) video to Facebook using the Facebook SDK for iOS. It worked without problems till a few weeks ago where it started failing with the f
Answers above work. But make sure you created the Facebook session, with openActiveSessionWithPublishPermissions not openActiveSessionWithReadPermissions.
I spent a day on this, because if you use the wrong one, you get the (in)famous "(#352) Sorry, the video file you selected is in a format that we don't support."
In any case the only permission you really need is publish_actions
I don't use key contentType
int params. It works well with Facebook SDK 3.10 (latest)
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSString* videoName = [filePath lastPathComponent];
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:caption forKey:@"description"];
[params setObject:videoData forKey:videoName];
FBRequestConnection *requestConnection = [FBRequestConnection startWithGraphPath:@"me/videos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
}];
Just before FBRequest
Add a line to open FBRequestConnection
Worked for me.
[FBRequestConnection startWithGraphPath:@"me/videos"
completionHandler:^(FBRequestConnection *connection,
id result, NSError *error)
{
FBRequest *uploadRequest =
[FBRequest requestWithGraphPath:@"me/videos"
parameters:params HTTPMethod:@"POST"];
}];