我在实例化 CBCentralManager 时遇到问题。从 iOS 控制台监视它时,我收到一条“重复问题”消息(它未显示在 XCode 控制台中)。
我已经尝试更新队列名称 和恢复 key 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,0,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,genp,E99372E2,L,ck,X2W6M5UYJ9.com.mydomain.myapp,0,acct,svce,v_Data,20151218165347.298588Z,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
, 和使用后台模式使用蓝牙 LE 配件在 Xcode 中设置:
关于iOS 蓝牙状态保存和恢复的重复问题 -25299,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34360660/