iBeacon: get major and minor - only looking for uuid

前端 未结 3 1550
花落未央
花落未央 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:21

    • CLBeaconRegion is the filter criteria to find beacons. So what you pass in is what you are going to get back when "didEnterRegion" delegate fires. No surprises there.

    • CLBeacon is the individual beacon that has to fit the filter criteria to fire the didEnterRegion delegate. So here is where you will find the major, minor values. To get the beacon that fired you need to call the ranging API startRangingBeaconsInRegion and give it a count of 5 before you stop ranging. Do this after you get didEnterRegion callback. This is catered towards background monitoring for beacons, when you do not want to launch your app. but just note down when a user passes by a beacon for building intelligence on the server for a better targeted Ad campaign.

    Sometimes ranging might not find any beacons, in that case use the beaconRegion in the callback for startRangingBeaconsInRegion to note down that someone entered a beacon region.

提交回复
热议问题