我在我的应用程序中创建了一个视频。 我想通过Facebook本地SDK将此视频分享给用户的Facebook墙。 我能够获得视频共享工作,但在共享之前没有向用户显示预览/共享对话框。该视频直接发布到用户的墙上。 这里是我的代码来获得打开活动会话通过适用于iOS的FB SDK将视频分享至Facebook
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceOnlyMe allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error){}
一旦我得到会话使用,我叫下面的方法来分享视频
- (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是:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, @"video.mov",
@"video/quicktime", @"contentType",
@"Video Test Title", @"title",
@"Video Test Description", @"description",
nil];
就发布视频而言,这很有效。但是,我想要显示共享/预览对话框。 有人知道如何完成它?
请新的Facebook SDK点击此处查看 http://stackoverflow.com/a/29427089/2787452 – Eliza