Question

im using this but i don't know how to monitor more then 20 region because its max region number in ios can monitored

if ([AllRegionsArray count] > 0) {


    for (int i = 0; i < [AllRegionsArray count]; i++) {
        NSArray *LongLati = [AllRegionsArray objectAtIndex:i];
        lutiuid = [LongLati objectAtIndex:0];
        Longtuid = [LongLati objectAtIndex:1];

        CLLocationCoordinate2D centreLoc = {[lutiuid floatValue], [Longtuid floatValue]};
        CLLocationDistance regionRadius = 150.00;
        CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:centreLoc radius:regionRadius identifier:[NSString stringWithFormat:@"grRegion%i",i]];

        [locationManager startMonitoringForRegion:grRegion desiredAccuracy:acc];

        NSLog(@"Mon = %i , %i",[locationManager.monitoredRegions count],i);

    }


}
Was it helpful?

Solution

You just can't monitor more than 20 regions. Maybe you could stop monitoring some regions depending on user location and start some others (depending on your use case).

Discussion You must call this method once for each region you want to monitor. If an existing region with the same identifier is already being monitored by the application, the old region is replaced by the new one. The regions you add using this method are shared by all location manager objects in your application and stored in the monitoredRegions property.

Region events are delivered to the locationManager:didEnterRegion: and locationManager:didExitRegion: methods of your delegate. If there is an error, the location manager calls the locationManager:monitoringDidFailForRegion:withError: method of your delegate instead.

An app can register up to 20 regions at a time. In order to report region changes in a timely manner, the region monitoring service requires network connectivity.

In iOS 6, regions with a radius between 1 and 400 meters work better on iPhone 4S or later devices. (In iOS 5, regions with a radius between 1 and 150 meters work better on iPhone 4S and later devices.) On these devices, an app can expect to receive the appropriate region entered or region exited notification within 3 to 5 minutes on average, if not sooner.

https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instm/CLLocationManager/startMonitoringForRegion:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top