I have a custom class that has as an instance variable of a coordinate:
CLLocationCoordinate2D eventLocation;
@property(nonatomic) CLLocationCoordinate2D eventLocation;
I'm parsing an xml file that has an optional field that may or may not be there. If it is i set it like so:
CLLocationCoordinate2D location;
NSArray *coordinateArray = [paramValue componentsSeparatedByString:@","];
if ([coordinateArray count] >= 2) {
location.latitude = [[coordinateArray objectAtIndex:0] doubleValue];
location.longitude = [[coordinateArray objectAtIndex:1] doubleValue];
} else {
NSLog(@"Coordinate problem");
}
info.eventLocation = location;
What I do this is basically add an annotation on a map
annotation.coordinate = alert.info.eventLocation;
I know I need to do some checking here to make sure that that exists but I'm not allowed to do a if (info.eventLocation == nil)
or even if (info.eventLocation.latitude == nil)
This seems like a very basic question but I've done some searching and no one's been able to really provide a good answer/idea. Is my architecture completely off?