Unity facebook SDK, can not post picture with FB.Feed

◇◆丶佛笑我妖孽 提交于 2020-01-01 05:28:28

问题


In my Unity IOS game, I am unsuccessfully trying to use FB.Feed to share a screenshot on the user's wall. Facebook documentation uses FB.Api to publish the screenshot, but this method does not display a share dialog, it simply uploads the pic to Facebook.

Answers I have found so far:

  1. Upload the picture using FB.Api, and then parse the FBResult for the picture URL, and feed that to FB.Feed Link to answer. This method triggers an error, since it is not possible to use a Facebook URL as source for a picture.

  2. Save the picture locally and prepend "File://" to the picture path. Link to question. This does not seem to work either, and the Facebook documentation does not seem to have any information on URL formatting.

My question:

Is this the correct (and only) way to display a share dialog when publishing a picture? Or am I looking in the wrong direction?


回答1:


FB.Feed only allows you to post link to images. It doesn't upload the images to Facebook. Therefore, these images need to hosted somewhere on the net and not locally.

The best way to make it work is either upload the images to FB (with privacy property set to EVERYONE) using FB.API, and then share the link to that picture via FB.Feed. If you don't want to create duplicate stories, i.e. one from posting the picture and another from FB.Feed, make sure that you set no_story to true.



来源:https://stackoverflow.com/questions/23912618/unity-facebook-sdk-can-not-post-picture-with-fb-feed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!