iOS蓝牙状态保存和恢复的DUPLICATE ISSUE -25299

我在实例化我的CBCentralManager时遇到了问题.从iOS控制台监控时,我收到“重复问题”消息(它没有显示在XCode控制台中).

我已经尝试更新队列名称和恢复密钥ID但没有成功.这是我实例化我的中央管理器的方式:

CBCentralManager *central = [[CBCentralManager alloc] initWithDelegate: self 
    queue: dispatch_queue_create("com.mydomain.myapp.scanner",NULL)
    options: @{
        CBCentralManagerOptionRestoreIdentifierKey: @"hexa-string-comes-here"
    }];

这些是我得到的错误

CKLs-iPhone-5S securityd[78] :
securityd_xpc_dictionary_handler MyApp[2571] add The operation
Couldn’t be completed. (Osstatus error -25299 – duplicate item
O,genp,E99372E2,L,ck,X2W6M5UYJ9.com.mydomain.myapp,acct,svce,v_Data,20151218165347.298588Z,2CAE5650)

CKLs-iPhone-5S MyApp[2571] : SecOsstatusWith
error:[-25299] The operation Couldn’t be completed. (Osstatus error
-25299 РRemote error : The operation Couldn’t be completed. (Osstatus error -25299 Рduplicate item
O,2CAE5650))

有任何想法吗?

解决方法

如果你想使用 CBCentralManagerOptionRestoreIdentifierKey,你必须

>实施方法

// in Objective-C
- (void)centralManager:(CBCentralManager *)central willRestoreState:(NSDictionary<Nsstring *,id> *)dict

// or in Swift
func centralManager(_ central: CBCentralManager,willRestoreState dict: [String : AnyObject])

CBCentralManagerDelegate起,和
>使用背景模式使用Xcode中设置的蓝牙LE配件:

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...