开发者

Calculate distance between two latitudes/longitudes in MapKit / CoreLocation

Im looking to use the getDistanceFrom method in CoreLocation to determine distance between two po开发者_高级运维ints, 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


You need to add a CoreLocation framework to the project.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜