Ios 解析JSon数据FlightAware
我正在使用航班感知服务获取航班信息,但在以我可以使用的方式获取数据时遇到问题 Json响应为:Ios 解析JSon数据FlightAware,ios,objective-c,json,parsing,Ios,Objective C,Json,Parsing,我正在使用航班感知服务获取航班信息,但在以我可以使用的方式获取数据时遇到问题 Json响应为: { "AirlineInfoResult": { "name": "US Airways", "shortname": "US Airways", "callsign": "Cactus", "location": "Tempe, AZ", "country": "United States", "
{
"AirlineInfoResult": {
"name": "US Airways",
"shortname": "US Airways",
"callsign": "Cactus",
"location": "Tempe, AZ",
"country": "United States",
"url": "http://www.usairways.com/",
"phone": "+1-800-428-4322"
}
}
这是我正在使用的代码,但没有返回任何内容
NSMutableDictionary * routeRes;
routeRes = [json objectForKey: @"AirlineInfoResult"];
NSMutableArray * res;
res = [json objectForKey: @"url"];
for (NSMutableDictionary * flight in res) {
NSLog(@"actual arrival time= %@", [flight objectForKey: @"url"]);
}
获取此数据时我缺少什么?更改以下行:
res=[json objectForKey:@“url”]
与
res=[routeRes objectForKey:@“url”]
res
应该是一个NSString
。请给出响应的URl。URl响应是最重要的部分如果我将res更改为NSString,我会得到此错误NSInvalidArgumentException',原因:'-[\u NSCFConstantString objectForKey::]:在您的回答中,发送到实例0x7fff72f4af10的选择器无法识别,您没有“实际到达时间”。和res=[routeRes objectForKey:@“url”]产生此错误的代码>countByEnumeratingWithState:objects:count::发送到实例0x10050c970 2014-03-29 10:16:54.423 FlightAwareCommandtool[471:303]***由于未捕获的异常“NSInvalidArgumentException”终止应用程序,原因:'-[\u NSCFString countByEnumeratingWithState:objects:count:]:无法识别的选择器已发送到实例0x10050c970'