was not verified"-6ren"> was not verified"-所以我试图简单地从 facebook 获取用户的个人资料照片,但我从 facebook.request(path) 得到空响应,并且 IOException“主机名 fbcdn-profile-a.a-6ren">
gpt4 book ai didi

java - Facebook Graph API 请求返回 IOException "Hostname was not verified"

转载 作者:行者123 更新时间:2023-12-01 05:18:18 24 4
gpt4 key购买 nike

所以我试图简单地从 facebook 获取用户的个人资料照片,但我从 facebook.request(path) 得到空响应,并且 IOException“主机名 fbcdn-profile-a.akamaihd.net 未验证” .

有人知道什么可能导致此异常吗?这是我调用 facebook.request 的方法:

public Bitmap getUserPic(String path){

URL picURL = null;


try {
responsePic = facebook.request(path);
picURL = new URL(responsePic);
HttpURLConnection conn = (HttpURLConnection)picURL.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
userPic = BitmapFactory.decodeStream(is);

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FacebookError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return userPic;

}

字符串“path”是“me/picture”

编辑:

还尝试将 picURL 设置为“https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/260885_608260639_822979518_q.jpg”,这是请求应返回的 URL。还是没有照片:(

感谢您的帮助

最佳答案

这听起来像是用于从 Facebook CDN 获取图像的 HTTPS 连接的问题。如果您请求图像的常规 HTTP 版本会发生什么?

例如http://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/260885_608260639_822979518_q.jpg

关于java - Facebook Graph API 请求返回 IOException "Hostname <fbcdn-profile-a.akamaihd.net> was not verified",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10852624/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com