我使用以下代码获取我的 facebook 用户个人资料,问题是,当我触发 newMeRequest 时,它从未响应。
会话已经打开,我还在 manifest.xml 中添加了互联网权限,如何解决?感谢您的帮助
public class ProfileFragment extends Fragment {
private View rootView;
private ImageView profilePic;
private Context ctx;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ctx = getActivity();
rootView = inflater.inflate(R.layout.profile, container, false);
profilePic = (ImageView) rootView.findViewById(R.id.profile_pic);
Session session = Session.getActiveSession();
if (session.isOpened()) {
Log.d("test1","success 123");
Request.newMeRequest(session, new MeReqCallback());
} else {
Log.d("test1","fail 123");
}
return rootView;
}
private class MeReqCallback implements GraphUserCallback {
@Override
public void onCompleted(GraphUser user, Response response) {
Log.d("test1",response.getError().getErrorMessage());
new ImageLoader(ctx).execute(profilePic,"https://graph.facebook.com/"+ user.getId() +"/picture");
}
}
登录后,进入成功123,但甚至没有进入onCompleted函数,这意味着甚至没有记录错误消息。
谢谢