- (void)centralManager:(CBCentralManager *)central willRestoreState:(NSDictionary *)state, not calling

Hi, I am working on a BLE project where I need to store STATE RESTORATION & PRESEVATION.


1. How to achive this ?

2.- (void)centralManager:(CBCentralManager *)central

willRestoreState:(NSDictionary *)state

, not calling. What is the scenerion to call this method.

Replies

Make sure to add a restoration identifier to the CBCentralManager's options dict when you instantiate it e.g.


let options = [CBCentralManagerOptionRestoreIdentifierKey : "com.xy.XYCentralManager"]
centralManager = CBCentralManager(delegate: self, queue: nil, options:options)


Then on an iOS 11 device power off the device while it's making a bluetooth connection from your app. When you relaunch -[CBCentralManager willRestoreState:] should be invoked with the active peripherals and services passed in the incoming dictionary.