Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 语义问题:属性';区域监控可用';找不到_Iphone_Core Location_Region - Fatal编程技术网

Iphone 语义问题:属性';区域监控可用';找不到

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

我想检查用户的iphone是否可以使用region monitoring,因此我使用CLLocationManager中的regionMonitoringAvailable属性进行检查,但是xcode说有一个错误:

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设备版本无关。