Iphone 目标c:如何从定位服务中找到航向(方向)?
我正在做定位服务,希望从定位服务中获得方向,我有所有想要的属性,例如纬度、经度等,但我也想找到方向(方向) 我从CLHeading中找到了一些线索,但仍然无法从CLHeading中获取。我正在使用上面的代码读取:) 我想你应该用trueHeading 真航向 相对于正北的航向(以度为单位)。(只读) @属性(只读,非原子)CLLocationDirection TrueTHeadingIphone 目标c:如何从定位服务中找到航向(方向)?,iphone,objective-c,ios,cllocationmanager,Iphone,Objective C,Ios,Cllocationmanager,我正在做定位服务,希望从定位服务中获得方向,我有所有想要的属性,例如纬度、经度等,但我也想找到方向(方向) 我从CLHeading中找到了一些线索,但仍然无法从CLHeading中获取。我正在使用上面的代码读取:) 我想你应该用trueHeading 真航向 相对于正北的航向(以度为单位)。(只读) @属性(只读,非原子)CLLocationDirection TrueTHeading i、 e.使用-(void)headingUpdate:(CLHeading*)heading{NSLog(@
i、 e.使用
-(void)headingUpdate:(CLHeading*)heading{NSLog(@“This heading%d”,[heading trueHeading]);}
但问题是headingUpdate未被激发。
(void)locationUpdate:(CLLocation *)location {
locationLable.text = [location description];
CLLocationCoordinate2D coordinate = [location coordinate];
NSLog(@"This is location %@",[location description]);
NSLog(@"Lattitude = %@",[NSString stringWithFormat:@"%f", coordinate.latitude]);
NSLog(@"Langitude = %@",[NSString stringWithFormat:@"%f", coordinate.longitude]);
NSLog(@"Altitude = %@",[NSString stringWithFormat:@"%gm", location.altitude]);
NSLog(@"horizontalAccuracy = %@",[NSString stringWithFormat:@"%gm", location.horizontalAccuracy]);
NSLog(@"verticalAccuracy = %@",[NSString stringWithFormat:@"%gm", location.verticalAccuracy]);
NSLog(@"Speed = %@",[NSString stringWithFormat:@"%gm", location.speed]);
}
- (void)headingUpdate:(CLHeading *)heading {
NSLog(@"This is heading %@",[heading description]);
}
- (void)viewDidLoad {
locationController = [[MyCLController alloc] init];
locationController.delegate = self;
[locationController.locationManager startUpdatingLocation];
[locationController.locationManager startUpdatingHeading];
}