1

我的代码如下:

public void logoutFromFacebook() {
    mAsyncRunner.logout(this, new RequestListener() {
        @Override
        public void onComplete(String response, Object state) {
            Log.d("Logout from Facebook", response);

            if (Boolean.parseBoolean(response) == true) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                    // make Login button visible
                    btnFbLogin.setVisibility(View.VISIBLE);

                    // making all remaining buttons invisible
                    btnFbGetProfile.setVisibility(View.INVISIBLE);
                    btnPostToWall.setVisibility(View.INVISIBLE);
                    btnShowAccessTokens.setVisibility(View.INVISIBLE);
                    btnFbLogout.setVisibility(View.INVISIBLE);
                }
            });
        }
    }

    @Override
    public void onIOException(IOException e, Object state) {

    }

    @Override
    public void onFileNotFoundException(FileNotFoundException e,
    Object state) {
    }

    @Override
    public void onMalformedURLException(MalformedURLException e,
    Object state) {
    }

    @Override
    public void onFacebookError(FacebookError e, Object state) {
    }
});
}

但它不起作用并显示错误validating access Token。谁能给我一个解决方案?

4

1 回答 1

0

错误消息显示“无效的应用程序 ID”的原因是因为您没有提供应用程序 ID,或者您提供的应用程序 ID 无效。

您必须确保Facebook以以下方式在代码的开头实例化

Facebook facebook = new Facebook(YOUR_APP_ID_HERE);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
于 2012-09-20T18:18:25.547 回答