开发者

How to upload video on facebook using iphone sdk 4.0?

开发者 https://www.devze.com 2023-01-21 16:23 出处:网络
I am trying to upload video on Facebook. But my code is not working: FBRequest *m_UploadRequest = [[FBRequest requestWithSession: _session delegate: self] retain];

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消