Iphone 语义问题:属性';区域监控可用';找不到
我想检查用户的iphone是否可以使用region monitoring,因此我使用CLLocationManager中的regionMonitoringAvailable属性进行检查,但是xcode说有一个错误:Iphone 语义问题:属性';区域监控可用';找不到,iphone,core-location,region,Iphone,Core Location,Region,我想检查用户的iphone是否可以使用region monitoring,因此我使用CLLocationManager中的regionMonitoringAvailable属性进行检查,但是xcode说有一个错误: error: Semantic Issue: Property 'regionMonitoringAvailable' not found on object of type 'CLLocationManager *' 这是我的密码: CLLocationManager *loca
error: Semantic Issue: Property 'regionMonitoringAvailable' not found on object of type 'CLLocationManager *'
这是我的密码:
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
if (locationManager.regionMonitoringAvailable) {
NSLog(@"test");
}
有人知道为什么会这样吗?非常感谢 它是类方法,不是实例方法。所以你需要这个:
if ([CLLocationManager regionMonitoringAvailable]) {
NSLog(@"test");
}
在将应用程序部署到设备之前,错误显示在xcode中,因此我猜这与iOS设备版本无关。