问题描述
几天前,我通过Facebook开发人员的电子邮件收到了以下警告:
作为Graph API 8.0 release的一部分,我们宣布了对 开发人员可以访问用户图片和FB / IG OEmbed端点。我们是 在下面包括有关这些更改的更多信息,以便您进行 对您的应用进行适当的更新。
Facebook现在将需要客户端或应用程序访问令牌来访问 查询用户ID时用户的个人资料图片。从开始 2020年10月24日,根据用户ID查询个人资料图片 没有访问令牌的用户将返回通用剪影,而不是 个人资料图片。虽然用户需要客户端或应用令牌 ID查询,它们将继续是最佳做法(而不是 暂时)进行ASID查询。您可以阅读更多有关 我们的用户图片开发人员文档中的更改。
根据以上消息,我不确定我的代码块是否会受到影响。这是代码:
val profilePicUrl = Profile.getCurrentProfile().getProfilePictureUri(600,600).toString()
该行在用户登录后获取用户个人资料图像的URI 。
SDK的源代码:
/**
* Getter for the profile that is currently logged in to the application.
* @return The profile that is currently logged in to the application.
*/
public static Profile getCurrentProfile()
{
return ProfileManager.getInstance().getCurrentProfile();
}
/**
* Getter for the Uri of the profile picture.
*
* @param width The desired width for the profile picture.
* @param height The desired height for the profile picture.
* @return The Uri of the profile picture.
*/
public Uri getProfilePictureUri(
int width,int height) {
return ImageRequest.getProfilePictureUri(this.id,width,height);
}
public static Uri getProfilePictureUri(
String userId,int width,int height) {
Validate.notNullOrEmpty(userId,"userId");
width = Math.max(width,UNSPECIFIED_DIMENSION);
height = Math.max(height,UNSPECIFIED_DIMENSION);
if (width == UNSPECIFIED_DIMENSION && height == UNSPECIFIED_DIMENSION) {
throw new IllegalArgumentException("Either width or height must be greater than 0");
}
Uri.Builder builder =
Uri.parse(ServerProtocol.getGraphUrlBase())
.buildUpon()
.path(String.format(
Locale.US,PATH,FacebookSdk.getGraphApiVersion(),userId));
if (height != UNSPECIFIED_DIMENSION) {
builder.appendQueryParameter(HEIGHT_PARAM,String.valueOf(height));
}
if (width != UNSPECIFIED_DIMENSION) {
builder.appendQueryParameter(WIDTH_PARAM,String.valueOf(width));
}
builder.appendQueryParameter(MIGRATION_PARAM,MIGRATION_VALUE);
我不确定是否会因为不特别使用Graph API
而受到影响?
有人能对此有所启发吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)