Ich verwende einen Webdienst, der JSON zurückgibt. Einer der Werte, die ich bekomme, ist "<null>"
.ios: NSString mit "<null>" vergleichen funktioniert nicht
Wenn ich den folgenden Code ausführe, wird die Anweisung if immer noch ausgeführt, wenn sie nicht unterstützt wird.
Gründe warum?
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
}
*** Was ist der Grund für den Downvote? *** –
+1 Perfekte Lösung. – Anupdas
Ja! Die zweite Antwort, die du mir gegeben hast, hat funktioniert. Vielen Dank. – wwjdm