Instance Method

centralManagerDidUpdateState(_:)

Invoked when the central manager’s state is updated.

Required.

Declaration

func centralManagerDidUpdateState(_ central: CBCentralManager)

Parameters

central

The central manager whose state has changed.

Discussion

You implement this required method to ensure that Bluetooth low energy is supported and available to use on the central device. You should issue commands to the central manager only when the state of the central manager is powered on, as indicated by the CBCentralManagerState.poweredOn constant. A state with a value lower than CBCentralManagerState.poweredOn implies that scanning has stopped and that any connected peripherals have been disconnected. If the state moves below CBCentralManagerState.poweredOff, all CBPeripheral objects obtained from this central manager become invalid and must be retrieved or discovered again. For a complete list and discussion of the possible values representing the state of the central manager, see the CBCentralManagerState enumeration in CBCentralManager.

See Also

Monitoring Changes to the Central Manager’s State

func centralManager(CBCentralManager, willRestoreState: [String : Any])

Invoked when the central manager is about to be restored by the system.