是否可以使用ShareKit的一些分支将视频发布到Facebook?我不想自己搞乱整个Facebook图形API,但是喜欢发布视频的能力。
答案 0 :(得分:1)
在pull request中,某些服务(包括Facebook)的视频共享ShareKit 2.0 repo。它还没有合并,因为有一些未解决的问题,最严重的问题是,如果你共享大型视频,它会耗尽设备的内存。
但对你来说这可能是一个好的开始。
答案 1 :(得分:0)
而不是使用sharekit我建议使用FBGraphAPI ...
以下步骤,您可以在Facebook上发布视频..
<。>文件中的
#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);
}