以下是我的代码:
facebookModule.requestWithGraphPath(
'me/albums', {
fields : 'id,name,cover_photo,count,created_time'
},
'GET',
function(graphResp) {
if(graphResp.success) {
if(graphResp.result) {
var albums = JSON.parse(graphResp.result).data;
//get all album ids.
for(x in albums) {
var albumId = albums[x].id;
//get album covers
//var albumCovers= "https://graph.facebook.com/" + (albums[x].cover_photo || 0) + "/picture?access_token=" + facebookModule.accessToken;
//get photos
var photos = "https://graph.facebook.com/" + (albums[x].cover_photo || 0) + "/photos?access_token=" + facebookModule.accessToken;
console.log(test);
}
}
} else if(graphResp.cancelled) {
alert("User Cancelled");
} else {
Ti.API.debug(graphResp.result);
}
}
);
当我console.log
时,我会得到一个网址列表,这些网址是从图表api生成的。但是我为每个人返回一个空的json对象 - 因此没有显示该特定专辑的照片。
var photos = "https://graph.facebook.com/" + (albums[x].cover_photo || 0) + "/photos?access_token=" + facebookModule.accessToken;
该专辑的图表api调用已在上面。