当 Apple 发布 iOS 10 时,一些 iPad 用户报告该应用程序停止工作时,我在 iPhone 和 Ipad 上拥有应用程序访问晴雨表。我在我的 iPhone 6s iOS 10 上进行了测试,它仍然可以正常工作。搜索 Apple Dev,没有 API 更改。在应用程序中,我使用以下代码获取气压计传感器信息:
if([CMAltimeter isRelativeAltitudeAvailable]){ // This return false on iPad
[self.altimeterManager startRelativeAltitudeUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMAltitudeData *altitudeData, NSError *error) {
if (self.delegate){
[self.delegate updatePressure: altitudeData.pressure.doubleValue*10.0];
}
}];
}