问题
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