2013-12-17 80 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