简体   繁体   中英

iOS - Can't share images to Facebook anymore?

This doesn't work anymore to share images. The image is not displayed in the FB popup window, nor does it gent sent to FB. The image is valid and the same code works for Twitter. Is there some new workaround to be able to share images to Facebook?

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
    {
        SLComposeViewController *composeController = [SLComposeViewController
                                                      composeViewControllerForServiceType:SLServiceTypeFacebook];

        [composeController setInitialText:@"whatever"]; //this doesn't work either
        [composeController addImage:self.shareImageView.image];
        [composeController addURL:[NSURL URLWithString:@"https://whatever"]];

        SLComposeViewControllerCompletionHandler completionBlock = ^(SLComposeViewControllerResult result){

            if (result == SLComposeViewControllerResultDone) {
                //done
            }

        };
        composeController.completionHandler = completionBlock;

        [self presentViewController:composeController
                           animated:YES completion:nil];
    }

EDIT: If I remove addURL: it works. So is there no way to share an image along with a URL?

Check this out: https://developers.facebook.com/docs/apps/review/prefill

"Add your own content to that which the user manually entered. This includes hashtags, hyperlinks or URLs." is considered a violation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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