Search code examples
androidfacebookfacebook-graph-apiunity-game-enginefacebook-unity-sdk

Unity facebook API FB.API() java.io.FileNotFoundException


I ran into a problem. I am using Unity facebook SDK and FB.API to post on user feed.

The Code I am using is:

if (FB.IsLoggedIn) {
        var data = new Dictionary<string, string>() {{"message", "I just scored "+score+" in GameName. Download it now!"}};
        FB.API ("/me/feed", HttpMethod.POST,LogCallback, data);
    }

void LogCallback (FBResult result) {
    if (result.Error != null) {
        print ("score submission failed with error= "+result.Error.ToString());
    }
    else {
        print ("score submitted with result= "+result.Text.ToString());
    }
}

and the result I am recieving is:

score submission failed with error= java.io.FileNotFoundException: https://graph.facebook.com/me/feed

I searched on the net and found that perhaps it has something to do with

publish_actions

permission. But I am using this permission.

I then went to the see the app on Facebook Developers and went to Status and Review. There Approved permissions are:

 email, public_profile and user_friends

I then tried to add

publish_actions

permission but it showed the error that I am missing icon, long description and privacy policy URL.

It wants to submit app for review. Am I doing everything correct? Do I need to upload android apk for them to review?

Can someone guide me? Thank you


Solution

  • You need to ask for publish_permissions from FB.Login first in order to use the /me/feed. (you'll see a message "this app wants to post on your behalf...")

    That said:

    • Using the graph API to post a message to a user's feed if the user hasn't explicitly clicked a button indicating they want it to happen is known as 'implicit shares' and is discouraged.
    • Using a message you create in code instead of letting the user type in their own message is known as "pre-filling" and is not allowed by Facebook policies.
    • You don't need publish_actions if you use the Facebook dialogs instead of the graph API.