4

I am afraid I know the answer to this.

Apple's location manager docs for the startMonitoringForRegion method say that you can monitor a maximum of 20 regions at a time.

I have a client app that makes heavy use of both geofence regions and beacon regions.

I had assumed that there were separate 20 region limits for geofence regions and beacon regions, but I fear that the limit is actually 20 regions total for both types.

Can somebody confirm my fears based on actual experience?

4

2 回答 2

5

是的,20 个区域限制是 CoreLocation 允许您同时监控CLBeaconRegions 和CLCircularRegions(地理围栏)的最大值。当 iOS 7 添加信标支持时,由于 API 的定义方式,信标区域继承了地理围栏的相同限制。正如您所怀疑的,该限制适用于您要监控的任何类型的区域。因此,您可以监控 10CLBeaconRegion秒和 10CLCircularRegion秒,但每种类型的组合不超过 20 个。

于 2016-03-23T13:14:05.860 回答
1

每种类型的限制为 20 个CLRegion。这意味着您可以监控 20CLCircularRegion和 20 CLBeaconRegion

这没有记录,但我做了一些测试并添加了超过 20CLBeaconRegion和超过 20 CLCircularRegion。结果self.locationManager.monitoredRegions.count40有 20monitoredRegions个 typeCLCircularRegion和另外 20 个 type CLBeaconRegion

一旦达到每种类型的限制CLRegion并尝试监视(该类型的)新区域,它们就会被忽略并使用错误代码locationManager:monitoringDidFailForRegion:withError:调用。kCLErrorRegionMonitoringFailure

于 2016-09-13T00:42:52.530 回答