I'm using the CoreBluetooth but I got this warning message in the output.
CoreBluetooth[WARNING] has no restore identifier but the delegate implements the centralManager:willRestoreState: method. Restoring will not be supported!
I'm using this code:
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], CBCentralManagerOptionShowPowerAlertKey, nil];
myCentralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:options];
I don't know what's wrong.
Thanks.
This is in regards to CoreBluetooth's save/restore optional feature, see "Opt In to State Preservation and Restoration" part of the documentation for more details.
What looks to be happening is that you are implementing the right delegate method to use this feature but you are not providing a restoration identifier in your call to initialize the CBCentralManager
.
There are two options to resolve the warning:
If you want to use this feature you should provide a string identifier that represents the central or peripheral manager to CBCentralManager like so:
myCentralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil
options:@{ CBCentralManagerOptionRestoreIdentifierKey:
@"myCentralManagerIdentifier" }];
If you don't want to use this feature then remove the centralManager:willRestoreState:
method from your delegate.
Doing either one should resolve your warning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With