"Error: type expected" when defining a method using CLLocationCoordinate2D
I am trying to make a static method that takes 2 parameters CLLocationCoordinate2D
and returns the distance between them (using Haversine's formula). This is how it is defined in the interface:
+ (CGFloat)haversineDistanceFromCoordinate:(CLLocationCoordinate2D)point1 toCoordinate:(CLLocationCoordinate2D)point2;
However, when building, I get 2 errors on this line saying "Expected type", one for each mention of CLLocationCoordinate2D. Also, in the implementation of this method, I get 2 warnings (again, one for each parameter) saying Conflicting parameter types in implementation of haversineDist...: 'id' vs 'CLLocationCoordinate2D'
. When I hit the CLLocationCoordinate2D command in the implementation or interface, I get the correct definition (in CoreLocation.framework). I looked for any circular references (there are only 3 imports in the header file, one is a subclass and the other is the protocols implemented by my class). Is there anything else that can go on?
source to share
No one has answered this question yet
Check out similar questions: