首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过FB为iOS将视频分享给facebook

通过FB为iOS将视频分享给facebook
EN

Stack Overflow用户
提问于 2013-08-06 06:41:25
回答 1查看 1.8K关注 0票数 1

我在应用程序中创建了一个视频。我想通过Facebook原生SDK将这个视频分享给用户的facebook墙。我可以让视频共享工作,但没有预览/共享对话框显示给用户在分享之前。视频直接张贴到用户的墙上。下面是打开活动会话的代码

代码语言:javascript
复制
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceOnlyMe allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error){}

一旦我激活了会话,我就调用下面的方法来共享视频

代码语言:javascript
复制
- (void)sendVideoFeedRequestWithParams:(NSMutableDictionary *)params
{
// create the connection object
FBRequestConnection *newConnection = [[FBRequestConnection alloc] init];

// create a handler block to handle the results of the request
FBRequestHandler handler =
^(FBRequestConnection *connection, id result, NSError *error) {
    // output the results of the request
    [self requestCompleted:connection result:result error:error];
};

// create the request object, using the /me as the graph path
FBRequest *request = [[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:@"me/videos" parameters:params HTTPMethod:@"POST"];

// add the request to the connection object, if more than one request is added
// the connection object will compose the requests as a batch request; whether or
// not the request is a batch or a singleton, the handler behavior is the same,
// allowing the application to be dynamic in regards to whether a single or multiple
// requests are occuring
[newConnection addRequest:request completionHandler:handler];

// if there's an outstanding connection, just cancel
[self.requestConnection cancel];

// keep track of our connection, and start it
self.requestConnection = newConnection;
[newConnection start];

}

我要发送给这个方法的params是:

代码语言:javascript
复制
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               videoData, @"video.mov",
                               @"video/quicktime", @"contentType",
                               @"Video Test Title", @"title",
                               @"Video Test Description", @"description",
                               nil];

就发布视频而言,这是很好的。但是,我希望显示一个共享/预览对话框。有人知道怎么做吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-06 06:55:45

您需要自己创建一些东西,或者在github (或类似的)上搜索现有的解决方案。类似自定义警报视图,您可以在其中允许用户输入文本,有一个缩略图的视频播放时,点击和几个按钮。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18073285

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档