vendredi 28 novembre 2014

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. I have used these code for posting video on 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.




Aucun commentaire:

Enregistrer un commentaire