ユーザーが Facebook アルバムの 1 つから写真を選択できるアプリを作成しています。彼らがアルバムを選択したら、「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' });
});