简体   繁体   中英

iphone sdk: Posting Video to Facebook throws format not supported error

I am trying to post videos to my Facebook wall through app but it always gives error " Sorry, the video file you selected is in a format that we don't support. "

I have got permissions for upload_video and pubish_actions too. I don't know what is going wrong.

Here is my code:

 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   videoData,@"source",
                                   @"video/quicktime", @"contentType",
                                   @"", @"name",
                                   description, @"description",
                                   nil];

    [FBRequestConnection startWithGraphPath:@"me/videos"
                                 parameters:params
                                 HTTPMethod:@"POST"
                          completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                              if (error.fberrorCategory != FBErrorCategoryUserCancelled) {
                                  [self presentAlertForError:error];
                              }
                              else {
                                  [self showAlert:@"Posted on your wall" title:nil];
                              }
                          }];

Thanks!

the params should be

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   videoData, @"video.mov",
                                   @"video/quicktime", @"contentType",
                                   @"Video Test Title", @"title",
                                   @"Video Test Description", @"description",
                       nil];

what video format do you have?

according to https://www.facebook.com/help/218673814818907/ the list of supported video types is:

 3g2 (Mobile Video) 3gp (Mobile Video) 3gpp (Mobile Video) asf (Windows Media Video) avi (AVI Video) dat (MPEG Video) divx (DIVX Video) dv (DV Video) f4v (Flash Video) flv (Flash Video) m2ts (M2TS Video) m4v (MPEG-4 Video) mkv (Matroska Format) mod (MOD Video) mov (QuickTime Movie) mp4 (MPEG-4 Video) mpe (MPEG Video) mpeg (MPEG Video) mpeg4 (MPEG-4 Video) mpg (MPEG Video) mts (AVCHD Video) nsv (Nullsoft Video) ogm (Ogg Media Format) ogv (Ogg Video Format) qt (QuickTime Movie) tod (TOD Video) ts (MPEG Transport Stream) vob (DVD Video) wmv (Windows Media Video) 

look at https://developers.facebook.com/blog/post/2011/08/04/how-to--use-the-graph-api-to-upload-a-video--ios/ for more information

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM