【发布时间】:2011-11-01 16:25:00
【问题描述】:
我正在使用
startMonitoringSignificantLocationChanges
用于获取 (lat,lon) 值。我的问题是
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
在遇到[locationMangerObject startMonitoringSignificantLocationChanges]; 后不会立即调用该方法。在didUpdateToLocation 方法中,我只维护两个全局双变量,用于保存从didUpdateToLocation 方法获得的坐标设置的纬度和经度。这些值被传递给 web 服务,因为 didUpdateToLocation 只被调用了一定的延迟,在这之间,(lat,lon) 的参数取零作为它们的值并传递给服务,这会导致意外的响应。
制作方法
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
在 `[locationMangerObject startMonitoringSignificantLocationChanges]; 之后立即调用的方法遇到了。
请任何人建议我解决此问题的解决方案。
提前致谢。
【问题讨论】:
-
设置 locationMangerObject.delegate = self;