简体   繁体   中英

Android Facebook login: ApiException:Cannot provide description for share_item

I have annoying problem with login via facebook with additional share_item permission. My code to login:

public void startFacebookLogin() {
    Session localSession = Session.getActiveSession();
    if ((!localSession.isOpened()) && (!localSession.isClosed())) {
        Session.OpenRequest localOpenRequest = new Session.OpenRequest(this);
        localOpenRequest.setCallback(this);
        localOpenRequest.setDefaultAudience(SessionDefaultAudience.EVERYONE);
        localOpenRequest.setPermissions("email", "share_item");
        localSession.openForRead(localOpenRequest);
        return;
    }
    Session.openActiveSession(this, true, this);
}

And code to obtain session login response:

@Override
public void call(Session session, SessionState state, Exception exception) {
    onSessionStateChange(session, state, exception);
    if(state == SessionState.OPENED) {
        String facebookToken = session.getAccessToken();
        processFacebookToken(facebookToken);
    }
}

The problem is when I call startFacebookLoging() first time, state in metod call is "CLOSED_LOGIN_FAILED" and exception is:

com.facebook.FacebookAuthorizationException: UnknownError: ApiException:Cannot provide description for share_item

When startFacebookLoing() is called second time Facebook SDK displaying "ask for permissions dialog", but only ask for "basic_info", after accept state in call() is "OPENED", without exception but permission "email" and "share_item" are not attached to session. I tested it on Facebook SDK 3.6 and 3.8.

Any ideas what is wrong? I was trying found "UnknownError: ApiException:Cannot provide description for share_item" in google but there wasn't any interesting results.

SOLVED: Ok, the problem is solved. Gracious Facebook developer respond me, that share_item is deprecated and now it doesn't work (Instead you can use publish_stream or something else...). But where wasn't any info in Facebook docs about that, thx for good support FB...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM