Facebook FB.ShareFeed not posting image linked

Hello, I’m trying to post to facebook, and all goes great. But when I use the FB.FeedShare and try to share a picture, even if I use FB’s ‘debugger’ to get the image first and cache it, even if I already share it a couple of times, it’s not showing my picture. Anyone ever get this issue? I’m also not getting the captions or descriptions… Just the picture from the link.

        FB.FeedShare(
            string.Empty, //toId
            new System.Uri(""), //link
            "BeetleJuice: Bad as Can", //linkName
            "", //linkCaption
            "Get BeetleJuice: Bad as Can for iOS and Android!", //linkDescription
            new System.Uri("http://www.flightsystemsllc.com/beetlejuicefb.png"), //picture
            string.Empty, //mediaSource
            ShareCallback //callback
        );
2 Likes

So, welcome to the wonderful world of Facebook where they change things and forget to really inform us or they don’t update their Unity SDK to reflect the changes (or their examples)

Basically, you can no longer use FeedShare or ShareLink the way it was intended. Instead, I had to create an html file with meta tags that I pass in as the first parameter in the ShareLink call. This meta html file contains all the information that we use to pass in in place of the parameters (note the rest of the sharelink parameters will be null or “”).

It’s a pain to deal with. It took a bit but we got the image working and then had to add some redirect code to the html file so that if a user clicks on the shared image it still takes them to the game and not to the html file link. While this may not be how to do it, it’s the only way I got it working right.

This is where they talk about the change https://developers.facebook.com/blog/post/2017/06/27/API-Change-Log-Modifying-Link-Previews/

And this talks a bit about the meta tag system that you’ll use Webmasters - Sharing - Documentation - Meta for Developers

7 Likes

Thanks! I didn’t know about that. I’m gonna try it out.

Hi Brathnann, can you please tell how to do this part?
"then had to add some redirect code to the html file so that if a user clicks on the shared image it still takes them to the game and not to the html file link. "
since the img its referenced on a meta tag on the head tag, it does not have an “a” tag, right? so how did you set the img to be a button redirecting to the link you’ve wanted?

how big, width and height should the imgs be?

Thanks a lot for your posts.

Unfortunately, I didn’t design the redirect on our website itself. In the html file with the meta tags (which are in the head part of the html) I just added

<body>
<script>
  window.location.assign("websiteLink here");
</script>
</body>

The website link is a link to our gamewebsite which then handles which platform they are on and redirects to the clicker to FB or one of the mobile stores. But our web person created that.

I can’t say this is the best solution though. Just what I did to address the issue.

Hi again, thanks a lot for your quick reply.
Well i do have a gamewebsite, i’ve created a different html for these sharing pourposes, in which i have added the meta tags on the head part, and now the script you just wrote on the body part (writing my gamewebsite link where you’ve indicated)…still when i click the image it send me to the html with the meta tags, not the gamewebsite .

I ask for the img size because im getting blurry results, it may be caused by the web images retina display issue, but no idea how to fix it in these particular case.

The feedshare call takes a link, this is where you pass in the link to the html file. This html file contains your metatags and the code I shared above for the body tags. Then when a user clicks the link, it goes to that html file which then redirects them to the link that you assign in the body tags.

Our share images are 1200x627 which I think was one of the sizes facebook recommends.

Hi Brathnann, i want to thank you, you were really helpfull.
i did have a little more struggle thought, “window.location.assign” for whatever reason did not worked, but “window.location.href” did just fine. I’ ve founded this method on:
https://appendto.com/2016/04/javascript-redirect-how-to-redirect-a-web-page-with-javascript/

Thanks again.

Oh one last question, as the info that appear on the share dialog is submited direcly on the html file, is there a way to use data stored on my c# variables? for example, scores?

Yeah, there were a few different methods that I found for the redirect. assign worked for what I did, so I went with it.

Glad you found something that worked for you! :slight_smile:

@Brathnann @daclu_10
did you find another solution??

@Brathnann How we can Share score its in c# Script How can i access it in HTML File

Score from where? I believe facebook is dropping score support if you mean from there. You’ll need to track score elsewhere.

@Barthnann score from unity c# script. i want to share highest score along with the title and description using fb.sharelink();

You can’t.

You’ll have to look into the post permission I think it is, but I haven’t ever used it so I can’t help you with that.