gpt4 book ai didi

android - picasso 图书馆今天停止使用 facebook 图图片链接

转载 作者:可可西里 更新时间:2023-11-01 18:49:37 26 4
gpt4 key购买 nike

在我的应用程序中,我使用 Picasso library从 url 加载图像。这是一个工作良好、易于导入和使用的库,只需做我需要的事情。

但是,今天它停止了工作,并且在开发时它并没有停止在编译的 apk 上工作。

所以在我搜索和搜索原因后,我才发现这个有问题的东西:

我使用 facebook 图 url 来加载个人资料图片。

这是一个这样的: profile pictre ,

链接实际上是“http://graph.facebook.com/1464090949/picture?type=large

但它正在重定向到: https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/572518_1464090949_1222130273_n.jpg

当然,这两个 url 调用都在浏览器中工作,并且您可以看到个人资料图片。

然而,当我用 Picasso 测试两个链接时:

    ImageView iv = (ImageView)findViewById(R.id.imageView1);

//Url1 NOT working, loads nothing.
String url1 = "http://graph.facebook.com/1464090949/picture?type=large";

//Url2 is the same as URL1, i just copied it from a browser, and this is working
String url2 = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/572518_1464090949_1222130273_n.jpg";


Picasso.with(this).load(url2).into(iv);

所以结论是,facebook 可能改变了一些东西,从现在开始 Picasso 无法从图表加载图像。

任何人都可以建议我一些东西来完成这项工作吗?当然,我可以尝试不同的库,但如果有其他方法,我会非常高兴。

最佳答案

解决方法 1:

从 http 更改为 https

工作: https://graph.facebook.com/1464090949/picture?type=large

不工作: http://graph.facebook.com/1464090949/picture?type=large

解决方法 2:

this 上找到解决方案主题。

如果你想举个例子: http://graph.facebook.com/1464090949/picture?type=large

您可以使用的头像:

https://graph.facebook.com/1464090949/?fields=picture.type(large)

返回一个 JSON 对象:

   {
"id": "1464090949",
"picture": {
"data": {
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/572518_1464090949_1222130273_n.jpg",
"is_silhouette": false
}
}
}

还有田田!就在那里。 url 的键是您可以用来加载图像的重定向 url。

(这将需要 oAuth 我没有测试过,只需坚持使用 Workaround1)

关于android - picasso 图书馆今天停止使用 facebook 图图片链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22674680/

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