iphone sdk:将视频发布到Facebook会抛出格式不支持错误

时间:2014-05-26 12:45:06

标签: ios iphone facebook

我正试图通过应用将视频发布到我的Facebook墙上,但它总是会出错“Sorry, the video file you selected is in a format that we don't support.

我也获得了upload_videopubish_actions的权限。我不知道出了什么问题。

这是我的代码:

 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];
                              }
                          }];

谢谢!

1 个答案:

答案 0 :(得分:0)

params应该

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

你有什么视频格式?

根据https://www.facebook.com/help/218673814818907/ 支持的视频类型列表如下:

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)

查看https://developers.facebook.com/blog/post/2011/08/04/how-to--use-the-graph-api-to-upload-a-video--ios/了解更多信息