2013-12-17 39 views
0

访问相册中的照片,我用下面的图查询的iOS FB图形API大规模

"me?fields=albums.fields(id,name)" 

我想获取有关每张专辑为此我使用

照片之后得到阵列的数量
NSString * graphPath = [NSString stringWithFormat:@"%@?fields=photos.fields(id,link,picture)", albumID]; 

通过使用这个我得到每张专辑的照片。但体积小巧。 我想这个照片在大尺寸

为此,我已搜查,我得到这个

[facebook requestWithGraphPath:@"me?fields=id,first_name,last_name,picture.type(large),gender,email" andDelegate:self]; 

但我认为这是对我的所有照片。我需要按专辑ID访问照片。 请帮助我如何编写查询以获取专辑ID的大尺寸照片。

我试过这个 NSString * graphPath = [NSString stringWithFormat:@"%@?fields=photos.fields(id,link,picture.type(large))", albumID]; 但没有结果。

在此先感谢。

回答

5

最后我得到了答案,它把我的6小时:( 检查下面的查询 的NSString * graphPath = [的NSString stringWithFormat:@ “?%@田= photos.fields(ID,路段,)”,ALBUMID];

只有我们需要更换代替图片。 所以它会返回原始图像的原始大小。

1
 NSString *albumUrl=[NSString stringWithFormat:@"https://graph.facebook.com/%@/photos?type=album&access_token=%@",albumId,fbAccessToken]; 

     NSLog(@"path %@",albumUrl); 
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:albumUrl]]; 
     NSURLResponse *response = nil; 
     NSError *error= nil; 
     NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; 
     NSString *responseString1 = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 
     NSLog(@"data is: %@",[responseString1 JSONValue]); 

您可以在控制台中看到输出,并且可以找到不同高度和大小的图像。你可以选择所需的一个。

控制台显示在一个样本画册ID的样品照片如下:

{ 
     "created_time" = "2013-08-08T06:58:29+0000"; 
     from =    { 
      id = 100004738364054; 
      name = "Rtpl Dev"; 
     }; 
     height = 183; 
     icon = "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif"; 
     id = 196228140545130; 
     images =    (
          { 
       height = 183; 
       source = "https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-frc3/1157748_196228140545130_1027750180_n.jpg"; 
       width = 275; 
      }, 
          { 
       height = 183; 
       source = "https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-frc3/q71/1157748_196228140545130_1027750180_n.jpg"; 
       width = 275; 
      }, 
          { 
       height = 119; 
       source = "https://fbcdn-photos-a-a.akamaihd.net/hphotos-ak-frc3/1157748_196228140545130_1027750180_a.jpg"; 
       width = 180; 
      }, 
          { 
       height = 86; 
       source = "https://fbcdn-photos-a-a.akamaihd.net/hphotos-ak-frc3/1157748_196228140545130_1027750180_s.jpg"; 
       width = 130; 
      }, 
          { 
       height = 86; 
       source = "https://fbcdn-photos-a-a.akamaihd.net/hphotos-ak-frc3/s75x225/1157748_196228140545130_1027750180_s.jpg"; 
       width = 130; 
      } 
     ); 
+0

它没有提供任何网址。 – Deepu

+0

您是否使用了有效的相册ID? – mak

+0

是的,我使用了完全相同的ID,但我没有得到。但使用后:@“%@?fields = photos.fields(id,link,source)”,albumID]我得到原始大小的图像。 – Deepu