我正在尝试获取此地址 =“8198 Snuffer School Rd, Gaithersburg, MD 20879, USA”
来自这个 json 请求,但无法成功。
{
"name": "39.165110,-77.168550",
"Status": {
"code": 200,
"request": "geocode"
},
"Placemark": [ {
"id": "p1",
"address": "8198 Snouffer School Rd, Gaithersburg, MD 20879, USA",
"AddressDetails": {
"Accuracy" : 8,
"Country" : {
"AdministrativeArea" : {
"AdministrativeAreaName" : "MD",
"Locality" : {
"LocalityName" : "Gaithersburg",
"PostalCode" : {
"PostalCodeNumber" : "20879"
},
"Thoroughfare" : {
"ThoroughfareName" : "Snouffer School Rd"
}
}
},
"CountryName" : "USA",
"CountryNameCode" : "US"
}
},
"ExtendedData": {
"LatLonBox": {
"north": 39.1661825,
"south": 39.1634846,
"east": -77.1666884,
"west": -77.1693864
}
},
"Point": {
"coordinates": [ -77.1685611, 39.1650977, 0 ]
}
} ]
}
我已经从状态中提取了代码,但不明白如何提取地址。
NSArray* Status = [(NSDictionary*)[responseString JSONValue] objectForKey:@"Status"];
NSString *code = [Status objectForKey:@"code"];
NSArray* Placemark = [(NSDictionary*)[responseString JSONValue] objectForKey:@"Placemark"];
NSString *address = [Placemark objectForKey:@"address"]; // got error at this line.