CBPeripheral objects are used to manage published services within the local peripheral device’s Generic Attribute Profile (GATT) database and to advertise these services to central devices (represented by
CBCentral objects). While a service is in the database, it is visible to, and can be accessed by, any connected central. That said, if your app has not specified the
bluetooth-peripheral background mode, the contents of its services become disabled when it is in the background or in a suspended state; any remote central trying to access the service’s characteristic value or characteristic descriptors receives an error.
- iOS 6.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 2.0+
- Core Bluetooth
Before you call
CBPeripheral methods, the state of the peripheral manager object must be powered on, as indicated by the
CBPeripheral. This state indicates that the peripheral device (your iPhone or iPad, for instance) supports Bluetooth low energy and that its Bluetooth is on and available to use.