I am trying to upload video on Facebook. But my code is not working:
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];
You can use the Facebook iOS SDK and should use the Graph API to upload a video:
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];
You may have to wait little bit for the video to upload to your profile but you should see eventually see it there.
精彩评论