<!--
{
  "documentType" : "article",
  "framework" : "CoreBluetooth",
  "identifier" : "/documentation/CoreBluetooth/central-manager-state-restoration-options",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Central Manager State Restoration Options"
}
-->

# Central Manager State Restoration Options

Restore central manager state in scene-based apps.

## Overview

In scene-based apps that adopt <doc://com.apple.documentation/documentation/UIKit/UISceneDelegate>, the `launchOptions` dictionary is always `nil` on launch, and apps can no longer rely on the system to hand back central manager identifiers at launch.

Instead, generate a stable UID for each [`CBCentralManager`](/documentation/CoreBluetooth/CBCentralManager), persist it (for example, in <doc://com.apple.documentation/documentation/Foundation/UserDefaults>) and pass it via [`CBCentralManagerOptionRestoreIdentifierKey`](/documentation/CoreBluetooth/CBCentralManagerOptionRestoreIdentifierKey) when creating the manager on every launch. When restoration is available, Core Bluetooth calls [`centralManager(_:willRestoreState:)`](/documentation/CoreBluetooth/CBCentralManagerDelegate/centralManager(_:willRestoreState:)) and passes the preserved state in the `dict` parameter.

```swift
func makeCentralManager(
    delegate: any CBCentralManagerDelegate
) -> CBCentralManager {
    let defaults = UserDefaults.standard
    let key = "MyCentralManagerUID"
    let uid: String
    if let saved = defaults.string(forKey: key) {
        uid = saved
    } else {
        uid = UUID().uuidString
        defaults.set(uid, forKey: key)
    }
    return CBCentralManager(
        delegate: delegate,
        queue: nil,
        options: [CBCentralManagerOptionRestoreIdentifierKey: uid]
    )
}
```

[`CBCentralManagerRestoredStatePeripheralsKey`](/documentation/CoreBluetooth/CBCentralManagerRestoredStatePeripheralsKey) contains peripherals that were connected or had a pending connection when the app stopped. [`CBCentralManagerRestoredStateScanServicesKey`](/documentation/CoreBluetooth/CBCentralManagerRestoredStateScanServicesKey) contains the service UUIDs your app was scanning for. [`CBCentralManagerRestoredStateScanOptionsKey`](/documentation/CoreBluetooth/CBCentralManagerRestoredStateScanOptionsKey) contains the scan options that were active. If your app also acts as a peripheral, see [Peripheral Manager State Restoration Options](/documentation/CoreBluetooth/peripheral-manager-state-restoration-options) for the equivalent pattern using [`CBPeripheralManagerOptionRestoreIdentifierKey`](/documentation/CoreBluetooth/CBPeripheralManagerOptionRestoreIdentifierKey).

## Topics

### State Restoration Options

[`CBCentralManagerRestoredStatePeripheralsKey`](/documentation/CoreBluetooth/CBCentralManagerRestoredStatePeripheralsKey)

An array of peripherals for use when restoring the state of a central manager.

[`CBCentralManagerRestoredStateScanServicesKey`](/documentation/CoreBluetooth/CBCentralManagerRestoredStateScanServicesKey)

An array of service IDs for use when restoring state.

[`CBCentralManagerRestoredStateScanOptionsKey`](/documentation/CoreBluetooth/CBCentralManagerRestoredStateScanOptionsKey)

A dictionary of peripheral scan options for use when restoring state.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)