In facebook graph API "https://graph.facebook.com/" url is used for all APIs. But to post a video on facebook an other API url is provided. To post video on facebook you must use "https://graph-video.facebook.com/me/videos" API.
Below is the code for sharing video on facebook using ASIFormDataRequest.
-(void)shareVideoOnFacebook:(NSData*)data WithTitle:(NSString*)title{
NSURL *url = [NSURL URLWithString:@"https://graph-video.facebook.com/me/videos"];
ASIFormDataRequest *newRequest = [ASIFormDataRequest requestWithURL:url];
[newRequest setPostValue:title forKey:@"title"];
[newRequest addData:data withFileName:@"videoOne.mov" andContentType:@"multipart/form-data" forKey:@"file"];
[newRequest setPostValue:yourAccessToken forKey:@"access_token"];
[newRequest setRequestMethod:@"POST"];
[newRequest setDidFinishSelector:@selector(postVideoOnFacebookFinished:)];
[newRequest setDidFailSelector:@selector(postVideoOnFacebookfailed:)];
[newRequest setDelegate:self];
[newRequest startAsynchronous];
}
0 Comment(s)