iosmapkitcore-locationclcircularregion

Geofencing Limits in iOS


I have a problem with the Geofencing Limits in iOS.

I'm building an app for smoke shops. Locations add up to about 200.

I want to have users 'automatically' check-in when they are a couple feet away from a shop.

The limit that's imposed by Apple is 20.

Apple Documentation

Regions are shared resources that rely on specific hardware capabilities. To ensure that all apps can participate in region monitoring, Core Location prevents any single app from monitoring more than 20 regions simultaneously. To work around this limitation, monitor only regions that are close to the user’s current location. As the user moves, update the list based on the user’s new location.

As seen in the documentation, Apple recommends developers to update the list of 20 regions as the user is updating his/her location.

enter image description here

Three questions come to mind.

  1. Documentation says "Core Location prevents any single app from monitoring more than 20 regions simultaneously.". Does this mean that, as a developer, I'm restricted to 20 locations I can set regions in my app? Because I have 200 locations (200 clients that want to have this feature around their store).

  2. Apple provides a work around to the limitation. Does this mean that the 20 region limit is only for the app users? Does this mean that I can set 200 locations, but users will only see 20 locations closest to them that they can check into?

  3. What happens when I have 10 users using my app and they have an amount of regions over 20 locations collectively?


Solution

  • 1 - That means that your app can track 20 geofences. If you want to track 200 geofences your can track always the 20 most closest regions. You need create an strategy to update your geofences list. For example you can update your 20 closes geofences when enter/leaving your geofences. Or can you update them in background when executing a background fetch.

    2 - Geofences is not the same that map regions. You can show as much regions as you want in a map (using for example mapkit).

    3 - The geofence limitation is given by device. Each user can track up to 20 geofences.