当我尝试获取我朋友的生日时,我得到一个空值。这是我设置权限的地方
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.activity_main, container, false);
LoginButton authButton = (LoginButton) view
.findViewById(R.id.authButton);
authButton.setFragment(this);
authButton.setReadPermissions(Arrays.asList("user_likes",
"friends_birthday", "friends_about_me"));
return view;
// return super.onCreateView(inflater, container, savedInstanceState);
}
这就是我试图获取生日的方式
private void onSessionStateChange(Session session, SessionState state,
Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
Request.executeMyFriendsRequestAsync(session,
new Request.GraphUserListCallback() {
@Override
public void onCompleted(List<GraphUser> users,
Response response) {
// TODO Auto-generated method stub
// Log.i("Response JSON", response.toString());
names = new String[users.size()];
id = new String[users.size()];
for (int i = 0; i < users.size(); i++) {
names[i] = users.get(i).getBirthday();
//id[i] = users.get(i).ge();
Log.i("Birthday chakk te bai ", "Birthday"
+ names[i]);
}
}
});
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
请看看为什么我得到 null 。当我为朋友的名字测试它时,keyhash 的每件事都很好。
应用程序仅处于沙盒模式。