iphone ShareKit 为 facebook 上传视频? [英] iphone ShareKit with Video upload for facebook?
本文介绍了iphone ShareKit 为 facebook 上传视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道我如何使用 Sharekit 将视频发布到 Facebook?我应该自定义它还是已经有可以从 sharekit 做到这一点的东西?我可以下载任何扩展程序吗?
Does anyone know how i can use Sharekit to post a video to facebook? Should i customize it or is there something already out there that can do this from sharekit? Any extensions i can download?
谢谢!
推荐答案
我建议使用 FBGraphAPI 而不是使用 sharekit...
Instead of using the sharekit i suggest to use FBGraphAPI for this...
以下是您可以在 Facebook 上发布视频的步骤..
Here are the following steps, that you can post video on 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 文件中调用这个方法.....
in .m file call this method.....
- (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);
}
这篇关于iphone ShareKit 为 facebook 上传视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文