在使用CoreLocation框架时有一个疑惑,它的更新频率是多久?因为它不够准确,我调用NSTimer的方法来中和使用的频率。代码如下:
在ViewDidLoad中:
//location update
CLController = [[CoreLocationController alloc] init];
CLController.delegate = self;
[CLController.locMgr startUpdatingLocation];
void方法:
- (void)locationUpdate:(CLLocation *)location {
int speedInt = [location speed]*2.23693629;
if(speedInt < 0){
speedInt = 0;
}
speedLabel.text = [NSString stringWithFormat:@"%d", speedInt];
}
- (void)locationError:(NSError *)error {
speedLabel.text = [error description];
}