Iam working on Location serves and want o get heading from location services, I have all desired attributes e.g. latitude, longitude etc but I want to find Direction (heading) too
(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 = %@",[NSS开发者_Python百科tring 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];
}
I found some clue to get it from CLHeading but still unable to get it from CLHeading. I am using the above code
Read http://developer.apple.com/library/ios/#DOCUMENTATION/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html :) I think you should use trueHeading, I guess..
trueHeading
The heading (measured in degrees) relative to true north. (read-only) @property(readonly, nonatomic) CLLocationDirection trueHeading
精彩评论