Reputation: 37580
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?
Upvotes: 12
Views: 5172
Reputation: 11462
it is clearly mentioned in the documentation that maximum regions are 20 .
Upvotes: 3
Reputation: 3746
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.
Upvotes: 1
Reputation: 11656
only for info:
no such API in swift.
Upvotes: 0
Reputation: 151
I've been testing and have reached the same conclusion. For some reason the maximum is 20 monitored regions.
Upvotes: 3
Reputation: 14164
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.
Upvotes: 7