加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xcode – CoreBluetooth [WARNING]没有恢复标识符,但委托实现

发布时间:2020-12-14 17:50:42 所属栏目:百科 来源:网络整理
导读:我正在使用CoreBluetooth,但我在输出中收到了此警告消息. CoreBluetooth [WARNING]没有恢复标识符,但委托实现了centralManager:willRestoreState:方法.不支持恢复! 我正在使用此代码: NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKe
我正在使用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:方法.

做任何一个应该解决你的警告.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读