我为登山者制作iOS应用程序以从 SeaLevel 获得高度,目前我被困在这里。我使用iOS Barometer获取详细信息,但它只提供压力,相对高度和时间戳。是否有计算从海平面获得高度? 我正在使用以下方式来获取值。我正在使用 CMAltimeter
NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
formatter.maximumFractionDigits = 2;
formatter.minimumIntegerDigits = 1;
NSNumber *timestamp = [NSNumber numberWithDouble:altitudeData.timestamp];
NSString *timeInterval = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:timestamp]];
NSString *altitude = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:altitudeData.relativeAltitude]];
NSString *pressure = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:altitudeData.pressure]];
self.label1.text = [NSString stringWithFormat:@"Time Interval: \n%@", timeInterval];
self.label2.text = [NSString stringWithFormat:@"Relative Altitude: \n%@", altitude];
self.label3.text = [NSString stringWithFormat:@"Air Pressure: \n%@", pressure];