Jona
Jona

Reputation: 13575

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. The APIs look very similar however they are missing the contentTitle and description. How do I set that? My API usage below works perfect just missing those two fields. 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];

Upvotes: 0

Views: 73

Answers (1)

Jigar
Jigar

Reputation: 1821

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

Upvotes: 1

Related Questions