Search code examples
iphonecore-locationregion

Semantic Issue: Property 'regionMonitoringAvailable' not found


I want to check if the user's iphone can use region monitoring, so I check it with regionMonitoringAvailable property in CLLocationManager, however xcode said there is an error:

error: Semantic Issue: Property 'regionMonitoringAvailable' not found on object of type 'CLLocationManager *'

Here is my code:

CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;

if (locationManager.regionMonitoringAvailable) {
    NSLog(@"test");
}

Anyone know why is this happened? Thanks very much!


Solution

  • It's a class method, not an instance method. So you need this:

    if ([CLLocationManager regionMonitoringAvailable]) {
        NSLog(@"test");
    }