Facebook ShareKit image caption not working

541 views Asked by At

Using Facebook iOS SDK v4

I used the following codes to share multiple images to Facebook:

NSMutableArray *fbPhotos = [NSMutableArray array];
for (UIImage* img in selectedImages) {
    FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
    photo.image = img;
    photo.caption = txtShareMessage.text;
    photo.userGenerated = YES;
    [fbPhotos addObject:photo];
}

FBSDKSharePhotoContent * content = [[FBSDKSharePhotoContent alloc] init];
content.photos = fbPhotos;
[FBSDKShareDialog showFromViewController:self
                             withContent:content
                                delegate:self];

However, the photo.caption does not appear in shared photos. Is this a bug of Facebook SDK?

On the other hand, is it possible to pre-filled the texts in FBSDKShareDialog?


UPDATE: just read the Platform Policy 2.3, Facebook starts forbidding pre-filling texts in FBSDKShareDialog. Therefore, my 2nd question is impossible to achieve at this moment.

1

There are 1 answers

1
Roemer On

The FBSDKSharePhotoContent mechanism relies on the same behaviour as FBSDKShareDialog. As you already found, it's not allowed to prefill these values. Recently this has been enforced computationally; the Share sheet does not accept any pre-filled values anymore.

This is intended and there is no workaround for it. You should change your app such that you don't ask for the photo caption, but let the user fill that in when they see the share dialog.