Changing Updating Frequency of CMAltimeter

2019-05-06 04:33发布

I am working on an app that uses the CMAltimeter class. I would like to retrieve altitude values quicker than the default value (default seems to be about once every second). How can I change the frequency? Will I need to use NSTimers/Multiple instances? If so, an explanation would 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);
         });
     }];
}

0条回答
登录 后发表回答