Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios: Compare NSString to "<null>" not working

Tags:

I am consuming a web service that returns JSON. One of the values I get is "< null >".

When I run the follwoing code the if statment still get executed when it is not suppposed to.

Any reason why?

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
}