我在onSessionStateChange
session.requestNewReadPermissions(new NewPermissionsRequest(this, Arrays.asList("user_photos")));
我收到此错误:
java.lang.UnsupportedOperationException:Session:尝试了 为具有待处理请求的会话请求新权限。
这是onSessionStateChange
回调的完整代码。
private void onSessionStateChange(Session session, SessionState state, Exception exception)
{
if (state.isOpened())
{
Log.i(TAG, "Logged in...");
m_lblWelcome.setText("You are logged in :)");
session.requestNewReadPermissions(new NewPermissionsRequest(this, Arrays.asList("user_photos")));
//Request.executeMeRequestAsync(session, getCurrentLoggedInUser);
}
else if (state.isClosed())
{
Log.i(TAG, "Logged out...");
m_lblWelcome.setText("Why did you leave :(");
}
}
我在这里做错了什么?
答案 0 :(得分:0)
在要求更多权限时,您需要在当前Session上调用onActivityResult()方法:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
uiHelper.onActivityResult(requestCode, resultCode, data);
}