我有以下无法从我的NSDictionary访问的密钥:
branches = (
{
city = "Las Vegas";
country = "United States";
countryIsoCode = USA;
distanceInKms = "19.35";
distanceInMiles = "12.02";
id = 16040146;
latitude = "36.145622";
longitude = "-115.299103";
name = "Las Vegas - 89117";
state = Nevada;
stateIsoCode = NV;
street = "9330 W Sahara Ave.";
telephone = "";
}
);
id = 106699;
logoUrl = "http://d2bvnbhf12ry1m.cloudfront.net/32636.png";
name = "Sumits Yoga";
},
我尝试使用NSLog(@“%@”,[字典allKeys]);我最终只得到以下内容:
feedSources,
deals,
errorCode,
ack,
timestamp,
owners,
version,
categories,
currentCount,
merchants,
errorMessage,
referencePoint,
queryString,
totalCount
)
其中没有一个是我需要的键和值:“纬度”和“经度”。 我如何访问这些值并将它们转换为NSString和NSNumber以便我可以存储它们?
答案 0 :(得分:1)
看起来你只有嵌套的词典,你可以这样访问:
branches[geoData][latitude]
您确定这是一个NSDictionary而不是JSON反序列化返回的对象吗? 2个代码块无论如何都不匹配,因此很难给出更好的答案。 branches
和dictionary
是同一个对象吗?