CBBeaconManagerDelegate Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | CBBeaconManager.h CBConstant.h |
– didChangeAuthorizationStatus:
Invoked when the authorization status changes for this application.
- (void)didChangeAuthorizationStatus:(CBAuthorizationStatus)status
Parameters
status |
The new authorization status for the application. |
---|
Discussion
Tells the delegate that the authorization status for the application changed.
This method is called whenever the application’s ability to use location services changes. Changes can occur because the user allowed or denied the use of location services for your application or for the system as a whole.
If the authorization status is already known when you call the requestWhenInUseAuthorization
or requestAlwaysAuthorization
method, the beacon manager does not report the current authorization status to this method. The beacon manager only reports changes to the authorization status. For example, it calls this method when the status changes from CBAuthorizationStatusNotDetermined
to CBAuthorizationStatusAuthorizedWhenInUse
.
See Also
Declared In
CBBeaconManager.h
– didRangeBeacons:inRegion:
Invoked when a new set of beacons are available in the specified region. If beacons is empty, it may be assumed no beacons that match the specified region are nearby. Similarly if a specific beacon no longer appears in beacons, it may be assumed the beacon is no longer received by the device.
- (void)didRangeBeacons:(NSArray<CBBeacon*> *_Nonnull)beacons inRegion:(CBRegion *_Nonnull)region
Parameters
beacons |
An array of |
---|---|
region |
The region object containing the parameters that were used to locate the beacons. |
Discussion
Tells the delegate that one or more beacons are in range.
The beacon manager calls this method when a new set of beacons becomes available in the specified region or when a beacon goes out of range. The beacon manager also calls this method when the range of a beacon changes; for example, when a beacon gets closer.
Declared In
CBBeaconManager.h
– rangingBeaconsDidFailForRegion:withError:
Invoked when an error has occurred ranging beacons in a region. Error types are defined in “CLError.h”.
- (void)rangingBeaconsDidFailForRegion:(CBRegion *_Nonnull)region withError:(NSError *_Nullable)error
Parameters
region |
The region object that encountered the error. |
---|---|
error |
An error object containing the error code that indicates why ranging failed. |
Discussion
Tells the delegate that an error occurred while gathering ranging information for a set of beacons.
Errors occur most often when registering a beacon region failed. If the region object itself is invalid or if it contains invalid data, the beacon manager calls this method to report the problem.
Declared In
CBBeaconManager.h
– didDetermineState:forRegion:
Invoked when there’s a state transition for a monitored region or in response to a request for state via a call to requestStateForRegion:
.
- (void)didDetermineState:(CBRegionState)state forRegion:(CBRegion *_Nonnull)region
Parameters
state |
The state of the specified region. For a list of possible values, see the |
---|---|
region |
The region whose state was determined. |
Discussion
Tells the delegate about the state of the specified region.
The beacon manager calls this method whenever there is a boundary transition for a region. It calls this method in addition to calling the didEnterRegion:
and didExitRegion:
methods. The beacon manager also calls this method in response to a call to its requestStateForRegion: method, which runs asynchronously.
Declared In
CBBeaconManager.h
– didEnterRegion:
Invoked when the user enters a monitored region. This callback will be invoked for every allocated CBBeaconManager
instance with a non-nil delegate that implements this method.
- (void)didEnterRegion:(CBRegion *_Nonnull)region
Parameters
region |
An object containing information about the region that was entered. |
---|
Discussion
Tells the delegate that the user entered the specified region.
Because regions are a shared application resource, every active beacon manager object delivers this message to its associated delegate. It does not matter which beacon manager actually registered the specified region. And if multiple beacon managers share a delegate object, that delegate receives the message multiple times.
The region object provided may not be the same one that was registered. As a result, you should never perform pointer-level comparisons to determine equality. Instead, use the region’s identifier string to determine if your delegate should respond.
Declared In
CBBeaconManager.h
– didExitRegion:
Invoked when the user exits a monitored region. This callback will be invoked for every allocated CBBeaconManager
instance with a non-nil delegate that implements this method.
- (void)didExitRegion:(CBRegion *_Nonnull)region
Parameters
region |
The exited region. |
---|
Discussion
Tells the delegate that the user left the specified region.
Because regions are a shared application resource, every active beacon manager object delivers this message to its associated delegate. It does not matter which beacon manager actually registered the specified region. And if multiple beacon managers share a delegate object, that delegate receives the message multiple times.
The region object provided may not be the same one that was registered. As a result, you should never perform pointer-level comparisons to determine equality. Instead, use the region’s identifier string to determine if your delegate should respond.
Declared In
CBBeaconManager.h
– didStartMonitoringForRegion:
Invoked when a monitoring for a region started successfully.
- (void)didStartMonitoringForRegion:(CBRegion *_Nonnull)region
Parameters
region |
The region that is being monitored. |
---|
Discussion
Tells the delegate that a new region is being monitored.
Declared In
CBBeaconManager.h
– monitoringDidFailForRegion:withError:
Invoked when a region monitoring error has occurred. Error types are defined in “CLError.h”.
- (void)monitoringDidFailForRegion:(CBRegion *_Nonnull)region withError:(NSError *_Nullable)error
Parameters
region |
The region for which the error occurred. |
---|---|
error |
An error object containing the error code that indicates why region monitoring failed. |
Discussion
Tells the delegate that a region monitoring error occurred.
If an error occurs while trying to monitor a given region, the beacon manager sends this message to its delegate. Region monitoring might fail because the region itself cannot be monitored or because there was a more general failure in configuring the region monitoring service.
Although implementation of this method is optional, it is recommended that you implement it if you use region monitoring in your application.
Declared In
CBBeaconManager.h