Contents

CBPeripheralManager

An object that manages and advertises peripheral services exposed by this app.

Declaration

class CBPeripheralManager

Overview

Core Bluetooth uses CBPeripheralManager objects to manage published services within the local peripheral’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, any connected central can see and connect to it. That said, if your app hasn’t specified the bluetooth-peripheral background mode, the contents of its services become disabled when it’s in the background or in a suspended state. In this scenario, any remote central trying to access the service’s characteristic value or characteristic descriptors receives an error.

Before you call CBPeripheralManager methods, the peripheral manager object must be in the powered-on state, as indicated by the CBPeripheralManagerState.poweredOn. This state indicates that the device (your iPhone or iPad, for instance) supports Bluetooth low energy and that its Bluetooth is on and available for use.

In watchOS, tvOS, and visionOS, you can’t advertise services using a CBPeripheralManager object because support for doing so is unavailable.

Topics

Initializing a Peripheral Manager

Monitoring the State of a Peripheral Manager

Adding and Removing Services

Managing Advertising

Sending Updates of a Characteristic’s Value

Responding to Read and Write Requests

Setting Connection Latency

Using L2CAP Channels

See Also

Peripherals