Change CMAltimeter refresh rate

I am working on an application using the CMAltimeter class. I would like to get the height values ​​faster than the default value (by default it is about once per second). How can I change the frequency? Do I need to use NSTimers / Multiple instances? If so, the explanation will be much appreciated.

if ([CMAltimeter isRelativeAltitudeAvailable])
{
    self.altimeterManager = [[CMAltimeter alloc] init];
    [self.altimeterManager startRelativeAltitudeUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMAltitudeData *altitudeData, NSError *error)
     {
         dispatch_async(dispatch_get_main_queue(), ^ {
             NSLog(@"%f", altitudeData.relativeAltitude.floatValue);
         });
     }];
}
+4
source share

All Articles