iOS 是否表示某个区域是否已停用?

Does iOS indicate if a region is deactivated?

我正在研究 iOS 信标应用程序并且遇到了一个令人担忧的规范。据我了解,在 iOS 8+ 中一次最多可以 enabled/defined 20 个区域(总数 - 不是每个应用程序)。看完后提出的几个问题。

  1. 信标区域与 GPS/geofencing 区域不同,还是它们都被认为是相同的?它们都计入最多 20 个区域吗?
  2. 如果一台设备在不同的应用程序中定义了超过 20 个区域,那么如何知道他们的区域是否正在被监控?
  3. 如果某个区域 deactivated/replaced 来自竞争应用的不同区域,是否会在该区域被停用之前向该应用发送通知?
  4. 区域被其他应用推出后如何重新激活?

据我所知,区域没有 "priority" 级别,也没有指示哪些区域应该处于活动状态。它是否根据最近 accessed/brought 哪些应用程序进入前台运行?

好消息!限制是针对每个应用程序,而不是针对每个设备。因此,很容易在应用程序内部跟踪您正在监视的许多人。

我不确定你在哪里读到的。如果您 post 消息来源,也许我们可以尝试进行更正或澄清。

需要注意的是,尽管限制是针对每个应用的,但 iOS 设备中的蓝牙硬件辅助过滤器肯定有限制。目前尚不清楚在硬件辅助达到其限制并且检测速度减慢之前,可以跨设备上的所有应用程序监视多少区域。

以下答案的斜体部分直接引自 Apple 的文档,并带有相关页面的链接。

Are beacon regions different than GPS/geofencing regions, or are they all considered the same? Do they all count towards the 20 region max?

The region monitoring service operates independently of any location services in use by your app, and you may use it in conjunction with any of the other services. 来自 "CLLocationManager Class Reference."

If a device has more than 20 regions defined across different apps, how does one know if their region is actively being monitored?

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. To work around this limit, consider registering only those regions in the user’s immediate vicinity....(添加了强调)有关更多信息,请参阅位置和地图编程指南中的"Region Monitoring and iBeacon"。

由于您被限制为每个应用程序 20 个区域,因此系统实际上能够监控的区域不止于此。考虑到上述建议,您似乎不太可能需要同时监控近 20 个区域。

If a region is deactivated/replaced by a different region from a competing app, is there a notification sent to the app prior to the region being deactivated?

If you attempt to register a region and space is unavailable, the location manager calls the locationManager:monitoringDidFailForRegion:withError: method of its delegate with the kCLErrorRegionMonitoringFailure error code.有关更多信息,请参阅位置和地图编程指南中的"Region Monitoring and iBeacon"。

听起来好像区域在您删除它们之前不会被停用,但如果没有 space,您可能无法添加区域。在这种情况下,您会收到引述中解释的错误。

How to reactivate a region once it has been pushed out by another app?

见上文。这不是先进先出的安排,而更像是抢椅子。如果没有 space,您首先无法添加您的地区。