Unity facebook SDK, cannot post image using FB.Feed

In my Unity IOS game, I unsuccessfully try to use FB.Feed to share a screenshot on a user's wall. The Facebook documentation uses FB.Api to post a screenshot , but this method does not display the sharing dialog, it just loads the pic. on Facebook.

The answers I have found so far:

  • Download the image using FB.Api and then parse the FBResult for the image URL and send it to the FB.Feed Link to the response . This method throws an error because it is not possible to use the Facebook URL as the source for the image.

  • Save the image locally and add the path to the file "File: //". Link to the question . This doesn't seem to work either, and the Facebook documentation doesn't seem to contain any URL formatting information.

My question is:

Is this the right (and only) way to display a sharing dialog when publishing an image? Or am I looking in the wrong direction?

+6
source share
1 answer

FB.Feed allows you to post links to images. It does not upload images to Facebook. Therefore, these images should be placed somewhere on the network, and not locally.

The best way to get it working is to either upload images to FB (with the privacy property set to EVERYONE ) using FB.API and then share the link to that image using FB.Feed. If you do not want to create repeating stories, i.e. One of the posts and the other from FB.Feed , make sure you set no_story to true.

+4
source

Source: https://habr.com/ru/post/969968/


All Articles