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