I have two coordinates:
@property (assign) CLLocationCoordinate2D coordinate1;
@property (assign) CLLocationCoordinate2D coordinate2;
During init I'm making them invalid (to be able to check later if it was set):
_coordinate1 = kCLLocationCoordinate2DInvalid;
_coordinate2 = kCLLocationCoordinate2DInvalid;
And then in method i check if they're valid:
- (void)checkIfValid {
BOOL coordinatesAreValid = (CLLocationCoordinate2DIsValid(_coordinate1) && CLLocationCoordinate2DIsValid(_coordinate2));
NSAssert(coordinatesAreValid, @"You didn't set up coordinates!");
}
Before i call the method, i set these coordinates via this way:
[_myclassinstance setCoordinate1:CLLocationCoordinate2DMake(mapView.region.center.longitude, mapView.region.center.latitude)];
[_myclassinstance setCoordinate2:CLLocationCoordinate2DMake(mapView.region.center.longitude, mapView.region.center.latitude)];
[_myclassinstance checkIfValid];
The problem is that an app claims, the coordinates are wrong. I've printed them, they seem to be ok:
(lldb) p _coordinate1
(CLLocationCoordinate2D) $1 = {
latitude = -122.4612387012154
longitude = 37.72925050874177
}
(lldb) p _coordinate2
(CLLocationCoordinate2D) $2 = {
latitude = -122.3582012987846
longitude = 37.84612098703619
}
However printing checking isn't working, also assert runs:
p (int)CLLocationCoordinate2DIsValid(_coordinate1)
(int) $3 = 0
Does anyone have any idea why is this happening? Any help will be welcomed :)