locationServicesEnabled从属性更改为方法。locationServicesEnabled适用于iOS 3和iOS 4
这是弃用:
CLLocationManager *manager = [[CLLocationManager alloc] init];
if (manager.locationServicesEnabled == NO) {
// ...
}
现在我应该使用:
if (![CLLocationManager locationServicesEnabled]) {
// ...
}
我想支持的iOS 3和iOS 4设备。我如何在iOS 3设备上检查这一点并摆脱已弃用的警告?
我试过你的方法,但无论一般位置服务是否启用,'locationServicesEnabled'总是YES。我检查了另一种方法,他从来没有进入这里'#if __IPHONE_OS_VERSION_MIN_REQUIRED> __IPHONE_3_1'(在iOS 4.1的iPod Touch 2G上测试过)看起来您的最低部署目标是正确的。 – testing 2010-10-27 13:24:19
现在我使用iPad进行了测试,但iPad也触及了方法而不是属性。 – testing 2010-10-27 13:52:10
基本SDK为4.1,部署目标为3.0 – testing 2010-10-27 14:04:20