- Home /
Facebook ShareLink & FeedShare Don't Use Title or Description
I'm using Facebook SDK 7.10.0 and whenever I call my ShareLink(); or FeedShare();, the links I use seem to overcome the post. No description, no title.
This is my code (Share is linked to a button): using System.Collections; using System.Collections.Generic; using UnityEngine; using Facebook.Unity; using UnityEngine.UI;
public class login : MonoBehaviour {
public GameObject DialogLoggedIn;
public GameObject DialogLoggedOut;
public GameObject DialogUsername;
public GameObject DialogProfilePic;
// Use this for initialization
void Awake () {
FB.Init(SetInit, OnHideUnity);
}
void SetInit() {
if (FB.IsLoggedIn) {
Debug.Log("FB is logged in");
} else {
Debug.Log("FB is not logged in");
}
DealWithFBMenus(FB.IsLoggedIn);
}
void OnHideUnity(bool isGameShown) {
if (!isGameShown) {
Time.timeScale = 0;
} else {
Time.timeScale = 1;
}
}
public void FBlogin() {
List<string> rpermissions = new List<string> ();
rpermissions.Add("public_profile");
List<string> ppermissions = new List<string> ();
ppermissions.Add("publish_actions");
FB.LogInWithReadPermissions(rpermissions, AuthCallback);
FB.LogInWithPublishPermissions(ppermissions, AuthCallback);
}
void AuthCallback (IResult result) {
if (result.Error != null) {
Debug.Log(result.Error);
} else {
if (FB.IsLoggedIn) {
Debug.Log("FB is logged in");
} else {
Debug.Log("FB is not logged in");
}
DealWithFBMenus(FB.IsLoggedIn);
}
}
void DealWithFBMenus (bool IsLoggedIn) {
if (IsLoggedIn) {
DialogLoggedIn.SetActive (true);
DialogLoggedOut.SetActive (false);
FB.API("/me?fields=first_name", HttpMethod.GET, DisplayUsername);
FB.API("/me/picture?type=square&height=128&width=128", HttpMethod.GET, DisplayProfilePic);
} else {
DialogLoggedOut.SetActive (true);
DialogLoggedIn.SetActive (false);
}
}
void DisplayUsername (IResult result) {
Text Username = DialogUsername.GetComponent<Text>();
if (result.Error == null) {
Username.text = "Hi there, " + result.ResultDictionary["first_name"];
} else {
Debug.Log(result.Error);
}
}
void DisplayProfilePic (IGraphResult result) {
if (result.Texture != null) {
Image ProfilePic = DialogProfilePic.GetComponent<Image>();
ProfilePic.sprite = Sprite.Create(result.Texture, new Rect(0,0,128,128), new Vector2());
}
}
public int score = 47;
public void Share () {
/*Dictionary<string, string> scoreData = new Dictionary<string, string>() {{"score", score.ToString()}};
FB.API ("/me/feed", HttpMethod.POST, ShareCallback, scoreData);*/
FB.ShareLink(
contentTitle:"My Game!",
//contentURL: new System.Uri("http://google.com"),
contentDescription: "Success Shared",
callback:ShareCallback
);
}
void ShareCallback (IResult result) {
if (result.Cancelled) {
Debug.Log("Share Cancelled");
} else if (!string.IsNullOrEmpty(result.Error)) {
Debug.Log("Error on Share!");
} else if (!string.IsNullOrEmpty(result.RawResult)) {
Debug.Log("Success on share");
}
}
Answer by jahester · Aug 14, 2017 at 07:49 PM
I've spent hours struggling with this issue using ShareLink thinking it must be our image hosting. It appears the argument list has changed. The documentation now only shows two arguments:
https://developers.facebook.com/docs/unity/reference/current/FB.ShareLink
So, apparently you can't specify an image and descriptive text anymore.
Answer by Fireflow-Prime · Jul 26, 2017 at 11:56 AM
Having the same problem. I've checked the payload sent to the android native lib and all seems ok. But the ShareLink just displays the informations gathered by the url, not the custom title, description or image.
Very weird because it definitly worked 1 month ago.
Answer by MaximSpirikhin · Jan 12, 2018 at 11:35 AM
Having the same issue. Any solution?
See my answer above. FB has changed the SD$$anonymous$$ and server API so Sharelink only takes a URL and callback as arguments now. Unfortunately, I don't think there's going to be a solution unless they decide to put the prior functionality back.
Answer by coutlass-supreme · Feb 25, 2018 at 05:26 PM
The sharelink now takes properties from the website itself, take a look at this websites source code: http://socialevent.mx/mirrorwebapp/sites/foto.php?img=636551232914581618.png
@coutlass-supreme What if want to share highscore with this information,$$anonymous$$y heighest score variable is in c# Script How can i access it in this html file..