我正在使用CoreBluetooth,但我在输出中收到了此警告消息.
CoreBluetooth [WARNING]没有恢复标识符,但委托实现了centralManager:willRestoreState:方法.不支持恢复!
我正在使用此代码:
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO],CBCentralManagerOptionShowPowerAlertKey,nil]; myCentralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:options];
我不知道出了什么问题.
谢谢.
解决方法
这是关于CoreBluetooth的保存/恢复可选功能,有关详细信息,请参阅
documentation的“选择状态保存和恢复”部分.
看起来正在发生的是您正在实现正确的委托方法来使用此功能,但您没有在调用中提供恢复标识符来初始化CBCentralManager.
>如果要使用此功能,则应提供表示CBCentralManager的中央或外围管理器的字符串标识符,如下所示:
myCentralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:@{ CBCentralManagerOptionRestoreIdentifierKey: @"myCentralManagerIdentifier" }];
>如果您不想使用此功能,请从您的委托中删除centralManager:willRestoreState:方法.
做任何一个应该解决你的警告.