我在我的應用程序中創建了一個視頻。 我想通過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