2009-12-07 303 views
0

进出口寻找使用getDistanceFrom方法CoreLocation确定两点之间的距离,而是试图用CoreLocation当我得到的错误...计算距离CoreLocation

即时通讯使用3.1。 2。我已经试过这一点,但返回一个错误:

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); 

错误给出:

".objc_class_name_CLLocation", referenced from: 
[email protected][email protected][email protected] in POIDetailViewController.o 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 

我这么想吗?我已经导入CoreLocation ...

此方法在3.1.2中已弃用吗?

谢谢

+0

这样就OK了,我固定的错误里面的框架搜索目录解决了,但现在我越来越返回'dist'一个庞大的数字(1862709713)?为什么会这样? – joec 2009-12-07 00:36:49

回答

0

从project.pbxproject文件中删除Xcode项目捆绑

1

您需要将CoreLocation框架添加到项目中。