<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreBluetooth",
  "identifier" : "/documentation/CoreBluetooth/CBCentralManagerDelegate/centralManager(_:willRestoreState:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Bluetooth"
    ],
    "preciseIdentifier" : "c:objc(pl)CBCentralManagerDelegate(im)centralManager:willRestoreState:"
  },
  "title" : "centralManager(_:willRestoreState:)"
}
-->

# centralManager(_:willRestoreState:)

Tells the delegate the system is about to restore the central manager.

```
optional func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any])
```

## Parameters

`central`

The central manager that provides this information.

`dict`

A dictionary that contains information about the central manager that the system preserved when your app stopped. For the available keys, see [Central Manager State Restoration Options](/documentation/CoreBluetooth/central-manager-state-restoration-options).

## Discussion

This method only applies to your app if it opts in to state restoration by providing [`CBCentralManagerOptionRestoreIdentifierKey`](/documentation/CoreBluetooth/CBCentralManagerOptionRestoreIdentifierKey) when initializing a [`CBCentralManager`](/documentation/CoreBluetooth/CBCentralManager). The system invokes this method when relaunching your app to service active or pending connections and scans that were in progress when your app stopped.

If the system calls this method but the parameters are missing (for example, if your app stopped before establishing peripherals and services), your app is responsible for restoring its previous state. Initialize any peripherals and services your app requires, and resume any activities from where they stopped.

```swift
func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) {
    if let peripherals = dict[CBCentralManagerRestoredStatePeripheralsKey] as? [CBPeripheral] {
        // Use the restored peripherals.
    } else {
        // Reconnect to known devices, for example from `UserDefaults`.
    }

    if let services = dict[CBCentralManagerRestoredStateScanServicesKey] as? [CBUUID] {
        // Resume scanning for the restored services.
    } else {
        // Start scanning with your default services.
        let heartRateService = CBUUID(string: "180D")
        central.scanForPeripherals(withServices: [heartRateService])
    }
}
```

---

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)