简体   繁体   English

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

[英]The Facebook SDK seems to be missing content title and description?

I have used the Facebook API to publish videos on Facebook and I'm now working on iOS to do the same. 我已经使用Facebook API在Facebook上发布视频,而我现在正在iOS上进行操作。 The APIs look very similar however they are missing the contentTitle and description. 这些API看起来非常相似,但是它们缺少contentTitle和描述。 How do I set that? 我该如何设置? My API usage below works perfect just missing those two fields. 我下面的API使用非常完美,只是缺少了这两个字段。 Anyone know how to include that? 有人知道如何包括吗?

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];

try this code because in this method you can share only video not text and description 请尝试此代码,因为在这种方法中,您只能共享视频,而不能共享文本和描述

 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
         }
     }];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM