iBeacon: get major and minor - only looking for uuid

前端 未结 3 1560
花落未央
花落未央 2020-12-08 05:52

I\'m using the air locate example and monitoring for iBeacons by uuid only. When I get the entered region event, I can\'t seem to get the major and minor from the beacon/re

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 06:24

    Unfortunately, determining the major and minor is only available in the iBeacon ranging API and not the iBeacon monitoring API if you monitored by UUID only. Furthermore,

    1) iBeacon ranging does not work while your app is in the background. This means if your app is in the background (which is most of the time for these types of apps) you cannot determine the major and minor of an iBeacon unless you monitored based on UUID, major and minor.

    2) You can only monitor a maximum of 20 iBeacons at the same time. This means if you resort to monitoring by UUID, major and minor (to get around the ranging in the background issue) you will be limited to only 20 iBeacons (a big limitation in most practical cases).

    3) For maximum scalability (since you can only concurrently monitor 20 iBeacons) it would be best to monitor by UUID only, notify the user when an iBeacon of that UUID is detected and upon notification the user could acknowledge to bring the app into the foreground. Once the app is in the foreground ranging can occur to determine the major and minor of the iBeacon.

    All of this leads me to wonder why Apple didn't include the array of iBeacons triggering the entry/exit in the monitoring API in the first place. I leave this for Apple to comment on. The following post goes into great detail on these iBeacon behaviors/limitations - iBeacon in the background - Use cases

提交回复
热议问题