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)
- If I haven't authorized the app, then I get a prompt for that as well.
- And then the Facebook Share Feed appears with all the specified information I put in the function, all the previous steps working properly.
- The problem starts once I touch the post button. The app starts uploading my post but then abruptly switches back to the game.
Tearing my hair out for the past 3 days. Can't find anything to help. Logs from the callback functions are return empty responses.