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 回答