views:

1597

answers:

3

Im looking to use the getDistanceFrom method in CoreLocation to determine distance between two points, but i get errors when trying to use CoreLocation...

Im using 3.1.2. I have tried this, but returns an error:

CLLocation *userLoc = [[CLLocation alloc] initWithCoordinate:appDelegate.mapView2.userLocation.coordinate];
CLLocation *poiLoc = [[CLLocation alloc] initWithLatitude: [aPOI.latitude doubleValue] longitude: [aPOI.longitude doubleValue]];

double dist = [userLoc getDistanceFrom:poiLoc] / 1000;

NSLog(@"%d",dist);

error given:

".objc_class_name_CLLocation", referenced from:
literal-pointer@__OBJC@__cls_refs@CLLocation in POIDetailViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

am i missing something? i have imported CoreLocation...

Is this method deprecated in 3.1.2?

Thanks

A: 

and how did you fixed this damn error?.......

Chicka
+1  A: 

You need to add a CoreLocation framework to the project.

konryd
A: 

Solved by removing the framework search directories from the project.pbxproject file inside the Xcode project bundle

joec

related questions