2011-07-08 10 views
4

誰もが私がFacebookにビデオを投稿するSharekitを使用する方法を知っていますか?私はそれをカスタマイズしなければならないのでしょうか、すでにそこにある共有キーからこれを行うことができるものがありますか?私がダウンロードできる拡張機能はどれですか?iphone ShareKit with facebookのビデオアップロード?

ありがとうございます!

答えて

2

の代わりに、私はこのためにFBGraphAPIを使用することをお勧めsharekitを使用して...ここで

は、あなたがFacebook上で動画を投稿することができますことを、次の手順..です

.hファイルで

#import "FbGraph.h" 
#import "FbGraphFile.h" 
#import "JSON.h" 
#import <MobileCoreServices/MobileCoreServices.h> 

@interface ViewController : UIViewController 
{ 
    FbGraph     *FB_Graph; 
    FbGraphResponse   *FB_Graph_Response; 
    FbGraphFile    *FB_Graph_File; 
} 

-(IBAction)btnShareVideoPress:(id)sender; 

@end 
.Mファイルの呼び出しで

この方法.....

- (void)viewDidAppear:(BOOL)animated 
{ 
    [super viewDidAppear:animated]; 

    NSString *ClientID = @"197556430726736"; 

    FB_Graph = [[FbGraph alloc]initWithFbClientID:ClientID]; 

    [FB_Graph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"]; 
} 

-(IBAction)btnShareVideoPress:(id)sender 
{ 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"YouTubeTest" ofType:@"m4v"]; 
    NSURL *videoURL1=[NSURL fileURLWithPath:path]; 

    NSMutableDictionary *variables = [[NSMutableDictionary alloc]init]; 

    FB_Graph_File = [[[FbGraphFile alloc] initwithURL:videoURL1]retain]; 

    [variables setObject:FB_Graph_File forKey:@"file"]; 

    [variables setObject:@"Test video upload 1" forKey:@"message"]; 
    [variables setObject:@"video" forKey:@"MediaType"]; 
    [FB_Graph doGraphPost:@"me/videos" withPostVars:variables]; 

    FbGraphResponse *fb_graphresponse = [FB_Graph doGraphGet:@"me/videos/uploaded" withGetVars:variables]; 

    NSLog(@"postPictureButtonPressed: %@", fb_graphresponse.htmlResponse); 
} 
+0

FbGraphFileはinitWithURLためのインタフェースを持っていません。使用しているファイルを添付してください –