Instance Method

centralManager(_:didDiscover:advertisementData:rssi:)

Invoked when the central manager discovers a peripheral while scanning.

Declaration

optional func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber)

Parameters

central

The central manager providing the update.

peripheral

The discovered peripheral.

advertisementData

A dictionary containing any advertisement data.

RSSI

The current received signal strength indicator (RSSI) of the peripheral, in decibels.

Discussion

The advertisement data can be accessed through the keys listed in Advertisement Data Retrieval Keys. You must retain a local copy of the peripheral if any command is to be performed on it. In use cases where it makes sense for your app to automatically connect to a peripheral that is located within a certain range, you can use RSSI data to determine the proximity of a discovered peripheral device.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software