Facebook post to wall give exception

限于喜欢 提交于 2019-12-24 13:43:15

问题


I want to post text message to my facebook wall. My example code is:

public void postOnMyFacebookWall(String msg) {
    Log.d("Tests", "Testing graph API wall post");
     try {
            String response = facebook.request("me");
            Bundle parameters = new Bundle();
            parameters.putString("message", msg);
            parameters.putString("description", "test test test");
            response = facebook.request("me/feed", parameters, 
                    "POST");
            Log.d("Tests", "got response: " + response);
            if (response == null || response.equals("") || 
                    response.equals("false")) {
               Log.v("Error", "Blank response");
           }
     } catch(Exception e) {
         e.printStackTrace();
     }
}

I have called authorize function and got access_token before making call to this function. But got the following type of error:

key message expected byte[] but value was a java.lang.String. The default value <null> was returned.

And when I see on my facebook wall, the post is visible there too... Any idea...???


回答1:


key message expected byte[] but value was a java.lang.String. The default value <null> was returned.

This Error will not affect your Post on wall, But update your code , that's old method for Post in wall,Try with this code for Post in Facebook Wall :

Bundle parameters = new Bundle();
parameters.putString("message", "Text is lame. Listen up:");
parameters.putString("method", "stream.publish");
String  response = ZValues.authenticatedFacebook.request(parameters);       
Log.v("response", response);


来源:https://stackoverflow.com/questions/7649620/facebook-post-to-wall-give-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!