Facebook SDK似乎缺少内容标题和描述?

时间:2017-02-28 03:19:23

标签: ios objective-c facebook

我已经使用Facebook API在Facebook上发布视频,而我现在正在使用iOS来做同样的事情。 API看起来非常相似,但它们缺少contentTitle和description。我该怎么设置?我的API使用情况完美,只是缺少这两个字段。有谁知道如何包含它?

NSURL *videoURL = [NSURL fileURLWithPath:videoPath];
FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];

video.videoURL = videoURL;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;

// Upload video
[FBSDKShareAPI shareWithContent:content delegate:self];

1 个答案:

答案 0 :(得分:1)

尝试此代码,因为在此方法中,您只能共享视频而非文字和说明

 if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"contact_email"]) {

    NSData *videoData = [NSData dataWithContentsOfURL:appDelegateObj.finalVideoUrl];
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:3L];

    [params setObject:videoData forKey:@"videofilename.MOV"];
    [params setObject:@"Your post title" forKey:@"title"];
    [params setObject:@"Your post description" forKey:@"description"];

    [[[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/videos" parameters:params HTTPMethod:@"POST"]
     startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
         if (!error) {
             //video posted
             NSLog(@"successfull %@:",result);
             strFbSocialPostId = [result valueForKey:@"id"];//post ID
         }
     }];
}