I am looking for how to use the apis barometer, which is available in iOS 8 for iPhone6.
I used the following code
if([CMAltimeter isRelativeAltitudeAvailable]){
CMAltimeter *altimeter = [[CMAltimeter alloc] init];
[altimeter startRelativeAltitudeUpdatesToQueue:queue withHandler:^(CMAltitudeData *altitudeData, NSError *error) {
if(error)
[label setText:[NSString stringWithFormat:@"%@",error.localizedDescription]];
else
[label setText:[NSString stringWithFormat:@"%@",altitudeData.relativeAltitude]];
}];
}
else{
[label setText:@"That not iPhone 6 for sure ;)"];
}
But its not working without even returning any error value. It seems that the completion block is not working, but my label is not updating. I am testing it on my iPhone 6.
source
share