4

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?

Community
  • 1
  • 1

1 Answers1

5

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.

Enrique Bermúdez
  • 1,740
  • 2
  • 11
  • 25
  • Hey thanks for you answer. Does this mean that I can set as many geofences as I want (as the developer) and the user will see up to 20 given his or her area when they're using the app? – javascriptcookie May 16 '18 at 19:35
  • No, you can call startMonitoring(for:) for 20 geofences. Thats means that the system will monitor the enter/leaving for those geofences. But if you need to track more than 20 regions you will need to implement your own strategy to get the most of those regions as I said you can keep updating the top closest regions. Over a map you can show as many regions as you want, becase they don't have nothing to do with the geofences tracked by the system. – Enrique Bermúdez May 16 '18 at 19:45
  • So if we're viewing this from the client-side, the client has the ability to track up to 20 geofences. Correct? – javascriptcookie May 16 '18 at 20:12
  • I just don't understand how the 20 geofence limitation applies to the 200 stores. If the number of stores increase to 200+ that require their customers to check-in, how would I be able to even implement these 200 stores when the limit is 20? – javascriptcookie May 16 '18 at 20:23
  • [Here](https://www.plotprojects.com/blog/how-to-monitor-more-than-20-regions-in-your-ios-app/) is an approach that you use. – Enrique Bermúdez May 16 '18 at 20:29