cover_photo
will not give you the url of the cover pic; instead it will give you the id of the cover pic. Example
So, when you do : \{cover-_pic}/photos
- this will give you a json, you'll have to fetch the required image from that. Example
質問
Below is my code:
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);
}
}
);
When I do console.log
I get a list of URLs, which are generated from the graph api. However I am returning an empty json object for each of them - hence no photos from that particular album is shown.
var photos = "https://graph.facebook.com/" + (albums[x].cover_photo || 0) + "/photos?access_token=" + facebookModule.accessToken;
The graph api call for that album is above.