I'm using the Unity Facebook SDK for my iOS game but FB.Feed isn't working. Using Unity 4.2.2 and Facebook SDK 4.2.4
Here's what happens:
Upon Game Start, FB init is called
void Awake () {
enabled = false;
FB.Init(SetInit, OnHideUnity);
}
private void SetInit()
{
enabled = true; // "enabled" is a magic global
FB.GetAuthResponse(LoginCallback);
}
private void OnHideUnity(bool isGameShown)
{
if (!isGameShown)
{
Time.timeScale = 0;
}
else
{
Time.timeScale = 1;
}
}
void LoginCallback(FBResult result)
{
Debug.Log("call login: " + FB.UserId);
FbDebug.Log("call login: " + FB.UserId);
Debug.Log("login result: " + result.Text);
FbDebug.Log("login result: " + result.Text);
if (result.Error != null)
{
Debug.LogError(result.Error);
return;
}
}
When I click the button for sharing on facebook, the following function is called:
public void FBShare() {
if(!FB.IsLoggedIn)
FB.Login("email,publish_actions", LoginCallback);
FB.Feed(
linkName: "My Game",
linkDescription: "Just played My Game. It's awesome!",
linkCaption: "I just smashed 4" + " friends! Can you beat it?",
picture: "http://www.friendsmash.com/images/logo_large.jpg",
callback: LogCallback
);
}
If I'm not logged in, then I get a login prompt on facebook (switching to the FB app)
Tearing my hair out for the past 3 days. Can't find anything to help. Logs from the callback functions are return empty responses.
I finally figured it out. The problem was an incorrect bundle ID on the Facebook app online, the changes took some time to propagate to all FB servers so it wasn't immediately apparent what was the problem.