The operation could not be completed. (error com.facebook.sdk 5.) FACEBOOK VIDEO UPLOAD

I wrote the following code to upload a video to facebook from an iOS device.

-(void)uploadVideo { NSLog(@"UPload Videio "); NSString *filePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"mov"]; NSLog(@"Path is %@", filePath); NSData *videoData = [NSData dataWithContentsOfFile:filePath]; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: videoData, @"video.mov", @"video/quicktime", @"contentType", @"Video Test Title", @"title", @"Video Test Description", @"description", nil]; // [facebook requestWithGraphPath:@"me/videos" // andParams:params // andHttpMethod:@"POST" // andDelegate:self]; if (FBSession.activeSession.isOpen) { [FBRequestConnection startWithGraphPath:@"me/videos" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if(!error) { NSLog(@"OK: %@", result); } else NSLog(@"Error: %@", error.localizedDescription); }]; } else { // We don't have an active session in this app, so lets open a new // facebook session with the appropriate permissions! // Firstly, construct a permission array. // you can find more "permissions strings" at http://developers.facebook.com/docs/authentication/permissions/ // In this example, we will just request a publish_stream which is required to publish status or photos. NSArray *permissions = [[NSArray alloc] initWithObjects: @"publish_stream", nil]; //[self controlStatusUsable:NO]; // OPEN Session! [FBSession openActiveSessionWithPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { // if login fails for any reason, we alert if (error) { // show error to user. } else if (FB_ISSESSIONOPENWITHSTATE(status)) { // no error, so we proceed with requesting user details of current facebook session. [FBRequestConnection startWithGraphPath:@"me/videos" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { // [FBRequestConnection setVideoMode:NO]; if(!error) { NSLog(@"VEEERRRRRRR: %@", result); } else NSLog(@"VVEEERRRRREEEERRR: %@", error.localizedDescription); }]; //[self promptUserWithAccountNameForUploadPhoto]; } // [self controlStatusUsable:YES]; }]; } } 

This gives me an error. The operation could not be completed. (com.facebook.sdk 5 error.)

I do not know what happened to facebook. It uploads an image, text, but in the video it gives this error.

NOTE:

  • This is not due to sending again and again since I also tested by creating a new account and rebooting the iOS device.
  • sample.mov also exists and works with the api chart, but the problem is with this SDK.

Thanks.

+7
ios facebook
source share
3 answers

A few reasons to view com.facebook.sdk 5 error:

  • The session is not open. Verification
  • Facebook has detected that you are a spam system. Change the name of the video.
  • Facebook has a certain limit using the SDK. Try another app.
  • Invalid permission to publish. Let's publish the publication.
  • further here ...?
+1
source share

After reading this solution. I was able to solve this problem.

 [FBRequestConnection startWithGraphPath:@"me/videos" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { [FBRequestConnection startWithGraphPath:@"me/videos" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if(!error) { NSLog(@"SUCCESS RESULT: %@", result); } else { NSLog(@"ERROR: %@", error.localizedDescription); } }]; }]; 
0
source share

I had this problem all day when I noticed that my application does not appear in:

Settings App-> Facebook β†’ "ALLOW THESE APPLICATIONS TO USE YOUR ACCOUNT"

This made me realize that posting to Facebook is not allowed by default, you should ask the user for their permission:

  [[FBSession activeSession] requestNewPublishPermissions:@[@"publish_actions"] defaultAudience:FBSessionDefaultAudienceFriends completionHandler:^(FBSession *session, NSError *error) { if (!error) { // UPLOAD VIDEO HERE AND THAT ERROR 5 SHOULD GO AWAY } }]; 
0
source share

All Articles