【问题标题】:Post Video To Facebook With ShareKit?使用 ShareKit 将视频发布到 Facebook?
【发布时间】:2012-04-29 21:39:06
【问题描述】:

是否可以使用 ShareKit 的一些分支将视频发布到 Facebook?我不想自己搞乱整个 Facebook 图形 API,但希望能够发布视频。

【问题讨论】:

标签: iphone facebook facebook-graph-api video sharekit


【解决方案1】:

pull request 用于视频共享 ShareKit 2.0 repo 用于某些服务,包括 Facebook。还没有合并,还有一些问题没有解决,最严重的就是分享大视频会耗尽设备内存。

但这对你来说可能是一个好的开始。

【讨论】:

  • 你知道这个pull request有什么消息吗?它似乎仍在等待合并到主 ShareKit,这意味着如果我使用拉取请求,我将错过过去 7 个月左右对完整 ShareKit api 的所有更新。我想我可以在本地进行合并,但如果有人已经这样做了,那显然会更好。
  • 正如您在拉取请求讨论中看到的那样,存在一些未解决的问题。这就是它尚未合并的原因。
【解决方案2】:

我建议不要使用共享工具包,而是为此使用 FBGraphAPI...

以下是您可以在 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);

 }

【讨论】:

  • FbGraphFile 没有用于 initWithURL 的接口。请附上您正在使用的文件
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-11-06
  • 1970-01-01
  • 2013-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多