由于权限不足,无法加载Android Facebook登录名

时间:2018-09-01 04:45:37

标签: android permissions facebook-login account-kit

我尝试通过从Facebook LoginButton调用registerCallBack来将登录与Facebook中的Facebook集成在一起,并且效果很好。但是我想用一个ImageButton自定义我的Facebook登录按钮,所以当我点击如下所示的自定义ImageButton时尝试了performClick()

callbackManager = CallbackManager.Factory.create();
LoginButton btnSignInFacebook = findViewById(R.id.btn_social_sync_facebook);
List<String> permissionNeeds = Arrays.asList("user_photos", "email",
            "user_birthday", "public_profile", "AccessToken");
    btnSignInFacebook.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(),
                    new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject object, GraphResponse response) {
                            startActivity(new Intent(SocialAccountsSyncActivity.this, AccountInformationSignUpActivity.class));
                        }
                    });
            Bundle parameters = new Bundle();
            parameters.putString("fields",
                    "id,name,email,gender, birthday");
            request.setParameters(parameters);
            request.executeAsync();
        }

        @Override
        public void onCancel() {

        }

        @Override
        public void onError(FacebookException error) {

        }
    });
}
@Override
public void onClick(View view) {
    switch (view.getId()) {
        //my customized imagebutton
        case R.id.ib_social_sync_facebook:
            btnSignInFacebook.performClick();
            break;
    }
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
}

这一直给我这个错误:

Unsupported get request. Object with ID '668803530142270' does not exist, cannot be loaded due to missing permissions, or does not support this operation.

任何人都知道原因,请帮助我。谢谢

0 个答案:

没有答案