CLBeaconRegion
A region for detecting the presence of iBeacon devices.
Declaration
class CLBeaconRegionMentioned in
Overview
A CLBeaconRegion object defines a region that you use to detect Bluetooth beacons conforming to the iBeacon specification. In contrast to a CLCircularRegion that centers on a geographic location, a CLBeaconRegion focuses on an iBeacon with specific identifying characteristics, which you provide. When a matching device comes in range, Core Location notifies your app.
You monitor beacon regions in two ways. To detect when a beacon is in range, use the startMonitoring(for:) method of your location manager object. After detecting a beacon, call the startRangingBeacons(in:) method to determine the relative distance to that beacon.
When detecting an iBeacon, you need to specify the proximityUUID, major, and minor values that you programmed into the beacon hardware. You use the values to identify your beacons uniquely, and you can specify a subset of values to detect multiple beacons. The proximityUUID property is typically the same for all of the beacons in your installation. Use the major and minor values to distinguish among different beacons in your installation.
If you want to configure the current iOS device as a Bluetooth beacon, create a beacon region with the appropriate identifying information. You can then call the peripheralData(withMeasuredPower:) method of the region to get a dictionary that you can use to advertise the device with the Core Bluetooth framework. For more information about using that framework to advertise the device as a beacon, see Turning an iOS device into an iBeacon device.
For information about how to detect beacons, see Determining the proximity to an iBeacon device.
Topics
Creating a beacon region
init(beaconIdentityConstraint:identifier:)init(uuid:identifier:)init(uuid:major:identifier:)init(uuid:major:minor:identifier:)CLBeaconMajorValueCLBeaconMinorValue
Getting the beacon identity
Specifying when to send notifications
Getting the beacon’s advertisement data
Deprecated
init(proximityUUID:identifier:)init(proximityUUID:major:identifier:)init(proximityUUID:major:minor:identifier:)proximityUUID