我使用 facebook api 将我的 apk 与 facebook 连接起来。我想在我的墙上贴一些文字,但我得到了错误。这是我的帖子类的代码:
public class UiAsyncTask extends AsyncTask<Void, Void, Void> {
public void onPreExecute() {
// On first execute
}
public Void doInBackground(Void... unused) {
Log.d("Tests", "Testing graph API wall post");
try {
String response = facebook.request("me");
Bundle parameters = new Bundle();
parameters.putString("message", "This test message for wall post");
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();
}
return null;
}
public void onPostExecute(Void unused) {
// Result
}
}
这是我在日志中得到的:
got response: {"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}
我该如何解决我的问题?