2010-10-20 102 views
2

我想在Facebook上上傳視頻。但我的代碼是不工作:如何使用iphone sdk 4.0在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];       

回答

3

您可以使用Facebook的iOS SDK,並應使用圖形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]; 

您可能不得不等待點點的視頻上傳到你的個人資料,但你應該看到最終在那裏看到它。

+0

謝謝Abernathy – Pankaj 2011-07-22 06:26:57

+0

嗨克里斯汀,你會碰巧有這個問題的答案:http://stackoverflow.com/questions/14383600/play-facebook-video-in-uiwebview。你是FB vid大師! – 2013-01-17 16:45:02

相關問題