[英]Getting error 'The operation couldn’t be completed. (com.facebook.sdk error 5.)' when Posting video on facebook from iphone
I'm getting an error(The operation couldn't be completed. (com.facebook.sdk error 5.))when posting video from ios device. 从ios设备发布视频时出现错误(操作无法完成。(com.facebook.sdk错误5。)。 I have used these code for posting video on facebook.
我已经使用这些代码在Facebook上发布了视频。
-(void)FBUploadVideoProcess
{
NSString *finalFileName=[NSString stringWithFormat:@"Documents/Book_%d/%@_%d.mov",self.book.bookId,self.book.bookName,self.book.bookId];
NSString *filePathOfVideo = [NSHomeDirectory()
stringByAppendingPathComponent:finalFileName];
NSData *videoData = [NSData dataWithContentsOfFile:filePathOfVideo];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, @"animation1.mp4",
@"video/quicktime", @"contentType",
self.book.bookName, @"name",
@"FlipIt Movie", @"description",
nil];
if (FBSession.activeSession.isOpen)
{
[FBRequestConnection startWithGraphPath:@"me/videos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error)
{
NSLog(@"RESULT: %@", result);
UIAlertView *alrtResult=[[UIAlertView alloc]initWithTitle:@"FlipIt" message:@"Upload Complete." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtResult show];
[spinner stopAnimating];
}
else
{
NSLog(@"ERROR: %@", error.localizedDescription);
UIAlertView *alrtResult=[[UIAlertView alloc]initWithTitle:@"FlipIt" message:error.localizedDescription delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtResult show];
[spinner stopAnimating];
}
}];
}
else
{
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"publish_actions",
nil];
// OPEN Session!
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
if (error)
{
NSLog(@"Login fail :%@",error);
UIAlertView *alrtResult=[[UIAlertView alloc]initWithTitle:@"FlipIt" message:error.localizedDescription delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtResult show];
[spinner stopAnimating];
}
else //if(FB_ISSESSIONOPENWITHSTATE(status))
{
NSLog(@"session...%d",FBSession.activeSession.isOpen);
[FBRequestConnection startWithGraphPath:@"me/videos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error)
{
NSLog(@"RESULT: %@", result);
UIAlertView *alrtResult=[[UIAlertView alloc]initWithTitle:@"FlipIt" message:@"Upload Complete." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtResult show];
[spinner stopAnimating];
}
else
{
NSLog(@"ERROR: %@", error.localizedDescription);
UIAlertView *alrtResult=[[UIAlertView alloc]initWithTitle:@"FlipIt" message:error.localizedDescription delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtResult show];
[spinner stopAnimating];
}
}];
}
}];
}
}
I have found lot of question related it, but yet I have not found my solution. 我发现了很多与此有关的问题,但是还没有找到解决方案。 Please help me.
请帮我。
You should match destination format to source video format which is mov. 您应该将目标格式与mov的源视频格式进行匹配。 Also "name" should be changed to "title".
同样,“名称”也应更改为“标题”。
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, @"animation1.mov",
@"video/quicktime", @"contentType",
self.book.bookName, @"title",
@"FlipIt Movie", @"description",
nil];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.