3

我正在尝试从 Facebook 页面获取特定专辑的封面照片。

for(NSDictionary *album in albums)
         {
             [albumNames addObject:[album objectForKey:@"name"]];
             NSLog(@"%@\n", [album objectForKey:@"id"]);
             [[FBRequest requestWithGraphPath:[NSString stringWithFormat:@"%@/photos", [album objectForKey:@"id"]] parameters:nil HTTPMethod:nil]
              startWithCompletionHandler:
              ^(FBRequestConnection *connection,
                FBGraphObject *albumPhoto,
                NSError *error) {
                  if(!error) {
                      [albumCoverPhotos addObject:[UIImage imageWithData:[[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:[[albumPhoto objectForKey:@"data"] objectForKey:@"picture"]]]]];
                  }
              }];
         }

但它从不执行该行if(!error),因此albumCoverPhotos在这段代码的末尾是空的。

我的目标是将页面的所有专辑的所有封面图片放入数组中albumCoverPhotos

4

0 回答 0