以下是我的代码但不起作用。任何人都可以帮助我吗?
- (void)viewDidLoad {
[super viewDidLoad];
CLController = [[CoreLocationController alloc] init];
CLController.delegate = self;
//[CLController setDesiredAccuracy:kCLLocationAccuracyBest];
[CLController.locMgr startUpdatingLocation];
}
- (void)locationUpdate:(CLLocation *)location {
locLabel.text = [location description];
}
- (void)locationError:(NSError *)error {
locLabel.text = [error description];
}
答案 0 :(得分:0)
您没有正确执行CLocationManager委托方法
(void)locationUpdate:(CLLocation *)location {
locLabel.text = [location description];
}
应该是
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
locLabel.text = [newLocation description];
}