No caption and description facebook feed.

Hi, I am trying to publish a feed to facebook, but it doesnt post the description and caption. I tried it with Interactive console example also.

37489-feed.jpg

Here is my code :

using UnityEngine;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

  public sealed class FbShareHighscore : MonoBehaviour {

     protected string lastResponse = "";
  void Awake(){
    CallFBInit();
    //FeedProperties.Add("key1", new[] { "valueString1" });
    //FeedProperties.Add("key2", new[] { "valueString2", "http://www.facebook.com" });
}

public void publishFeed(){
    lastResponse="publishFeed Clicked";
    if(FB.IsLoggedIn){CallFBFeed();}
    else{
        CallFBLogin();
    }
}

#region FB.Init()

private void CallFBInit()
{
    FB.Init(OnInitComplete, OnHideUnity);
}

private void OnInitComplete()
{
    Debug.Log("FB.Init completed: Is user logged in? " + FB.IsLoggedIn);
    lastResponse="FB.Init completed: Is user logged in? " + FB.IsLoggedIn;
}

private void OnHideUnity(bool isGameShown)
{
    Debug.Log("Is game showing? " + isGameShown);
}

#endregion

#region FB.Login()

private void CallFBLogin()
{
    FB.Login("email,publish_actions", LoginCallback);
}

void LoginCallback(FBResult result)
{
    if (result.Error != null)
        lastResponse = "Error Response:

" + result.Error;
else if (!FB.IsLoggedIn)
{
lastResponse = “Login cancelled by Player”;
}
else
{
lastResponse = “Login was successful!”;
CallFBFeed();
}
}

private void CallFBLogout()
{
    FB.Logout();
}
#endregion

#region FB.Feed()

public string FeedToId = "";
public string FeedLink = "";
public string FeedLinkName = "";
public string FeedLinkCaption = "Available on Google Play and iOS";
public string FeedLinkDescription = "Check out my high score";
public string FeedPicture = "";
public string FeedMediaSource = "";
public string FeedActionName = "";
public string FeedActionLink = "";
public string FeedReference = "";
public bool IncludeFeedProperties = false;
private Dictionary<string, string[]> FeedProperties = new Dictionary<string, string[]>();

private void CallFBFeed()
{
    Dictionary<string, string[]> feedProperties = null;
    if (IncludeFeedProperties)
    {
        feedProperties = FeedProperties;
    }
    FB.Feed(
        toId: FeedToId,
        link: FeedLink,
        linkName: FeedLinkName,
        linkCaption: FeedLinkCaption,
        linkDescription: FeedLinkDescription,
        picture: FeedPicture,
        mediaSource: FeedMediaSource,
        actionName: FeedActionName,
        actionLink: FeedActionLink,
        reference: FeedReference,
        properties: feedProperties,
        callback: Callback
        );
}

#endregion

protected void Callback(FBResult result)
{
    // Some platforms return the empty string instead of null.
    if (!String.IsNullOrEmpty (result.Error))
    {
        lastResponse = "Error Response:

" + result.Error;
}
else if (!String.IsNullOrEmpty (result.Text))
{
lastResponse = "Success Response:
" + result.Text;
}
else if (result.Texture != null)
{
lastResponse = "Success Response: texture
";
}
else
{
lastResponse = “Empty Response
“;
}
}
void OnGUI(){
GUI.Label(new Rect(10,(Screen.height/4),Screen.width,Screen.height/2),”:”+lastResponse);
}}

if you provide a feed link than only you can get other feed parameters working.

feed links are the links where you want to redirect some user if he clicks on the feed story link and action links are like adding a link on fb redirection like remember the game or something like that. If you want more info than refer following:

-feed link

-action link

I guess you are referring to feedlinkcaption not the feedlink…

linkCaption = Ignored if sharing a Google Play or iTunes App Store link.
linkDescription = Ignored if sharing a Google Play or iTunes App Store link.

This means that your message will not be shown if your sharing a Google Play or iTunes App link.

If you want to share the score and also have a link, becuase playstore links disable the link description (see vfxjex’s anser) use google’s url shortening, so the link in your code will not be a playstore link but the shortend link, which when clicked, will redirect the user to your app on the playstore

For me the post_id= null every time , when user cancel sharing post_id =null and if successfully posted post_id = null. this is for rewarding the user for sharing ,