0

Flickr API にクエリを実行したところ、辞書を含む NSArray が返されました。どうすれば、返された配列の _content アイテムにアクセスできるのだろうかと思っていました。

  NSArray *topPlaces = [FlickrFetcher topPlaces];
NSLog(@"%@",topPlaces);

(
    {
    "_content" = "London, England, United Kingdom";
    latitude = "51.506";
    longitude = "-0.127";
    "photo_count" = 3061;
    "place_id" = "hP_s5s9VVr5Qcg";
    "place_type" = locality;
    "place_type_id" = 7;
    "place_url" = "/United+Kingdom/England/London";
    timezone = "Europe/London";
    woeid = 44418;
},
    {
    "_content" = "New York, NY, United States";
    latitude = "40.714";
    longitude = "-74.007";
    "photo_count" = 1886;
    "place_id" = ".skCPTpTVr.Q3WKW";
    "place_type" = locality;
    "place_type_id" = 7;
    "place_url" = "/United+States/New+York/New+York";
    timezone = "America/New_York";
    woeid = 2459115;
},
    {
    "_content" = "Weston-Super-Mare, England, United Kingdom";
    latitude = "51.346";
    longitude = "-2.977";
    "photo_count" = 945;
    "place_id" = HWdHmQdVUrptMA;
    "place_type" = locality;
    "place_type_id" = 7;
    "place_url" = "/United+Kingdom/England/Weston-Super-Mare";
    timezone = "Europe/London";
    woeid = 40016;
},

)

4

1 に答える 1

0

そのようにNSArrayを繰り返すだけです

for (NSDictionary *dictionary in topPlaces) {
    NSLog(@"%@", [dictionary objectForKey:@"_content"]);
}
于 2012-07-28T22:34:43.127 に答える