I'm working on a simple app that will find a person's coordinates and altitude every second and it will display it on the screen. Finding coordinates was simple, but I scoured the internet and everything about altitude was so complex and required many different functions.
This is what I have so far. I'm using a "single view" format.
CLLocationManager *locationManager;
- (NSString *)deviceLocation {
return [NSString stringWithFormat:@"latitude: %f longitude: %f", locationManager.location.coordinate.latitude, locationManager.location.coordinate.longitude];
}
- (void)viewDidLoad
{
locationManager = [[CLLocationManager alloc] init];
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timer) userInfo:nil repeats:YES];
[super viewDidLoad];
}
-(void)timer
{
NSLog(@"%@", [self deviceLocation]);
coordinates.text = [self deviceLocation];
altitude.text = ;\\altitude goes here
}