我正在使用一个返回JSON的web服务。其中一个值我得到的是"< null >"
。
当我运行以下代码时,if语句仍会执行,尽管它不应该执行。
有任何原因吗?
NSDictionary *location = [dictionary valueForKey:@"geoLocation"]; //get the product name
NSString *latitude = [location valueForKey:@"latitude"];
NSLog(@"%@", latitude);
NSString *longitude = [location valueForKey:@"longitude"];
if (![latitude isEqual: @"<null>"] && ![longitude isEqual: @"<null>"]) {
NSLog(@"%d", i);
CLLocationCoordinate2D coordinate;
coordinate.longitude = [latitude doubleValue];
coordinate.longitude = [longitude doubleValue];
[self buildMarketsList:coordinate title:title subtitle:nil]; //build the browse list product
}
[NSNull null]
的描述。你还应该更仔细地阅读NSLog()
的文档。 - user529758