我正在制作一个应用程序,用户可以在其中从他们的 Facebook 相册中选择一张照片。当他们选择相册时,我调用:'albumId + "/picture"' 以获取该相册中的照片列表。我必须添加一个检查 response.data[a].privacy == "everyone" 否则如果它的隐私设置是 "friends",则该相册不会返回任何照片。即使它是属于用户的相册并且用户创建了它,他们也无法从中选择照片。有什么我遗漏的或者这是 Facebook 的规则吗?
$('.btn-facebook').on('click', function (e) {
e.preventDefault();
var index = $(this).data('index');
$("#albums").html("");
albumsString = "<img src='/Content/images/albums.png' />";
FB.login(function (response) {
if (response.authResponse) {
var uid = response.authResponse.userID;
$.colorbox({
href: '/Game/Albums',
innerWidth: 488,
innerHeight: 588,
top: 0,
left: 0,
onComplete: function () {
}
});
FB.api('/me/albums', function (response) {
for (var a = 0; a < response.data.length; a++) {
if (response.data[a].count != null) {
if (response.data[a].count > 0) {
if (response.data[a].privacy != null) {
if (response.data[a].privacy == "everyone") {
GetImg(response.data[a].id, index);
}
}
}
}
}
});
} else {
alert('User cancelled login or did not fully authorize.');
}
}, { scope: 'email, user_likes, publish_actions, user_photos, friends_photos' });
});