我想发短信到我的脸墙。我的示例代码是:
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();
}
}
在调用此函数之前,我调用了authorize函数并获得了access_token。但是出现了以下类型的错误:
key message expected byte[] but value was a java.lang.String. The default value <null> was returned.
当我在脸书墙上看到时,那里的帖子也可以看到...... 任何想法...... ???
答案 0 :(得分:2)
key message expected byte[] but value was a java.lang.String. The default value <null> was returned.
此错误不会影响您的帖子, 但是更新你的代码,这是Post in wall的旧方法,请尝试使用此代码在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);