Contents

peripheralManager(_:willRestoreState:)

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

Declaration

optional func peripheralManager(_ peripheral: CBPeripheralManager, willRestoreState dict: [String : Any])

Parameters

  • peripheral:

    The peripheral manager undergoing state restoration.

  • dict:

    A dictionary containing information about the peripheral manager that the system preserved when your app stopped. For the available keys to this dictionary, see Peripheral Manager State Restoration Options.

Discussion

This method only applies to your app if it opts in to state restoration by providing CBPeripheralManagerOptionRestoreIdentifierKey when initializing a CBPeripheralManager. The system invokes this method when relaunching your app to handle active advertising or peripheral operations in progress when your app stopped.

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

See Also

Monitoring Changes to the Peripheral Manager’s State