12

The documentation says there's a limit to the number of regions that can be monitored with-

(void)startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy

but I couldn't find what that limit is, does anybody know?

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378

6 Answers6

7

I have explored this a few times, and Apple intentionally doesn't say. All regions for the device go into one giant pool of monitored regions. So any regions you add have to be shared with other applications. I think the most I've heard successfully monitored is 20. But it is not an exact science. The OS will purge out any old regions if some other app needs to add newer regions. And likewise, your app could push out regions for other apps too.

It would be nice to have some better defined documentation on this for sure. If you download the console app, and add a bunch of regions from your app and say Notifications, there is a display log that will show you region count that runs on a pretty frequent basis. Remove a region, and you can see the count drop. Might come in helpful if you want to test out how many regions you can safely add. Good luck.

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
  • 17
    20 regions is documented in iOs 6 under startMonitoringForRegion http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instm/CLLocationManager/startMonitoringForRegion – Andrew Thomas Oct 29 '12 at 19:46
  • Whoa! That wasn't there before. At least not prior to iOS 6. Good find. – Bill Burgess Nov 01 '12 at 13:09
  • 1
    I've done some testing on an iOS8 iphone 5s. Once you hit 20 regions, you will no longer set any more. Old regions don't get evicted. Also, if anyone is curious (because the documentation isn't clear on this) you get to set 20 BeaconRegions and 20 CircularRegions. – James Sep 04 '15 at 18:03
  • Really?!?! That is good news. I assumed you only got 20 total since they are mostly the same. Good catch. – Bill Burgess Sep 04 '15 at 20:13
  • 1
    Reading from [documentation](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html), it says: "Be judicious when specifying the set of regions to monitor. Regions are a shared system resource, and the total number of regions available systemwide is limited. For this reason, Core Location limits to 20 the number of regions that may be simultaneously monitored by a **single app**". So basically your app won't push regions out from another, nor will theirs...Or is that you're saying docs is wrong? – mfaani Jul 29 '17 at 16:26
  • Comment was from 2015. It is clear through docs and usage each app gets 20. – Bill Burgess Jul 29 '17 at 20:38
3

I've been testing and have reached the same conclusion. For some reason the maximum is 20 monitored regions.

Oriol Blanc
  • 151
  • 2
  • 4
3

it is clearly mentioned in the documentation that maximum regions are 20 .

Link

Mutawe
  • 6,464
  • 3
  • 47
  • 90
Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70
1

I think the allowed region is 10 to 20.

László Papp
  • 51,870
  • 39
  • 111
  • 135
1

As of iOS 9.2.1 there has been no change to the limit of 20 regions. It may be worth pointing out that the first 20 are stored and not overwritten. If an attempt is made to add more, these are simply ignored.

Leon
  • 3,614
  • 1
  • 33
  • 46
0

only for info:

  • startMonitoringForRegion:desiredAccuracy: is DEPRECATED.

no such API in swift.

ingconti
  • 10,876
  • 3
  • 61
  • 48