我正在创建一个应用程序,用户可以从他们的一张Facebook专辑中选择一张照片。当他们选择一张专辑时,我会调用:'albumId +“/ picture”'来获取该专辑中的照片列表。我必须添加一个检查response.data [a] .privacy ==“everyone”,否则如果该专辑的隐私设置是“朋友”,则该专辑不会返回任何照片。即使它是属于用户的专辑并且用户创建了它,他们也无法从中选择照片。我有什么遗漏或这是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' });
});