我正在尝试在Facebook上传视频。但我的代码不起作用:
FBRequest *m_UploadRequest = [[FBRequest requestWithSession: _session delegate: self] retain];
NSURL *videoUrl=[NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];
NSData* VideoFileData = [NSData dataWithContentsOfURL:videoUrl];
NSMutableDictionary* Parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"video.upload", @"method", @"Video Title", @"title", nil];
[m_UploadRequest call: @"facebook.video.upload" params:Parameters dataParam: VideoFileData];
答案 0 :(得分:3)
您可以使用Facebook iOS SDK,并应使用Graph API上传视频:
NSURL *videoUrl=[NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];
NSData* VideoFileData = [NSData dataWithContentsOfURL:videoUrl];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
VideoFileData, @"video.mov",
@"video/mp4", @"contentType",
@"Video Title", @"title",
nil];
[facebook requestWithGraphPath:@"me/videos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
您可能需要等待一段时间才能将视频上传到您的个人资料中,但您最终应该会看到该视频。