Facebook4J朋友相册照片

时间:2015-01-22 13:25:41

标签: java facebook processing

我正在使用带处理/ Java的Facebook4J,我正在尝试提取朋友的信息'相片。我几个月前使用过代码,它工作正常,但现在返回所有字段为null。 有人可以帮助解决这个问题吗?以下是我用来提取照片的方式:

  User fbUser = facebook.getUser(userID);
  ResponseList<Album> albums = facebook.getAlbums(userID);
  String targetAlbumId = "";
  imgArray = new ArrayList<PImage>();

  for (Album album : albums) {
    //Get the album ID if it matches the string
    if (album.getName().equals("Cover Photos")) {
      targetAlbumId = album.getId();
      break;
    }
  }

  //Get all the photos that correspond to that Album ID
  //Create a string arraylist to store all the photo ID names
  ResponseList<Photo> photos = facebook.getAlbumPhotos(targetAlbumId);
  ArrayList<String> getPhotoId = new ArrayList<String>();

  //Get all photos in high quality. Create an arraylist of all the photos,
  //and an arraylist of all the photo IDs (to use later for getting their likes)
  for (Photo photo : photos) {  
    URL highQuality = photo.getImages().get(0).getSource();
    imgArray.add(loadImage(highQuality.toString()));
    getPhotoId.add(photo.getId());
  }

1 个答案:

答案 0 :(得分:0)

当您的应用使用Graph API v2.0或更高版本时,您无法再访问好友照片。

  

已删除所有friends_*权限。