Android SDK friend request returns “Sorry, something went wrong”

倾然丶 夕夏残阳落幕 提交于 2019-12-23 00:52:23

问题


I'm using the Facebook SDK for Android and when I send a friend request using the below code, I get the following error: "Sorry, something went wrong. We're working on getting this fixed as soon as we can."

Is this a problem on my side or on Facebook's? This code was working perfectly fine a few days ago. It opens up a popup with the friend request as usual. But when I click accept, it shows me the error page. Please help me.

    private void sendRequestDialog(String friendID)
{   
    Bundle params = new Bundle();

    params.putString("id", friendID);

    WebDialog friendDialog = (
            new WebDialog.Builder(context, Session.getActiveSession(), "friends", params))
    .setOnCompleteListener(new OnCompleteListener()
    {
        @Override
        public void onComplete(Bundle values, FacebookException error)
        {
            if(error != null)
            {
                if(error instanceof FacebookOperationCanceledException)
                {
                    Toast.makeText(context, "Friend Request Cancelled", Toast.LENGTH_SHORT).show();
                }
                else
                {
                    //Toast.makeText(getApplication().getApplicationContext(), "Network Error", Toast.LENGTH_SHORT).show();
                }
            }
            else
            {
                final String requestId = values.getString("request");
                if (requestId != null)
                {
                    Toast.makeText(context, "Friend Request Sent", Toast.LENGTH_SHORT).show();

                    removeFriend();
                }
                else
                {
                    Toast.makeText(context, "Friend Request Cancelled", Toast.LENGTH_SHORT).show();
                }
            }   
        }

    })
    .build();
    friendDialog.show();
}

回答1:


Try change

params.putString("id", friendID);

to

params.putString("to", friendID);



回答2:


I was struggling with the same issue.

The workaround for me was to double-check the permissions. (first_name, last_name with name, etc arent working correctly) You should start by removing all and only take "email" and then add the remaining permissions accordingly which will make it easier to understand.

LoginManager.getInstance().logInWithReadPermissions(
        this,
        listOf("email") //, "name", "first_name", "public_profile"
    )


来源:https://stackoverflow.com/questions/14883774/android-sdk-friend-request-returns-sorry-something-went-wrong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!