Using my 6+ I've been trying to read the relative altitude and pressure using CoreMotion's new CMAltimeter. However the callback is never firing. I have a very similar setup which instead uses the accelerometers, gyros, and magnetometers. They all seem to work fine.
Was wondering if anyone out there has managed to get a reading?
- (void)viewDidLoad {
[super viewDidLoad];
if([CMAltimeter isRelativeAltitudeAvailable]){
CMAltimeter *altimeterManager = [[CMAltimeter alloc]init];
[altimeterManager startRelativeAltitudeUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMAltitudeData *altitudeData, NSError *error) {
// This never fires.
NSString *data = [NSString stringWithFormat:@"Altitude: %f %f", altitudeData.relativeAltitude.floatValue, altitudeData.pressure.floatValue];
NSLog(@"%@", data);
self.altimeterLabel.text = data;
}];
NSLog(@"Started altimeter");
self.altimeterLabel.text = @"-\n-";
} else {
NSLog(@"Altimeter not available");
}
}
I've tried taking this on a quick walk, but there's only one story of altitude to lose/gain around here.