iOS 蓝牙状态保存和恢复的重复问题 -25299

标签 ios bluetooth duplicates core-bluetooth state-restoration

我在实例化 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 ,你必须

  1. 实现方法

    // in Objective-C
    - (void)centralManager:(CBCentralManager *)central willRestoreState:(NSDictionary<NSString *, id> *)dict
    
    // or in Swift
    func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : AnyObject])
    

    来自 CBCentralManagerDelegate , 和

  2. 使用后台模式使用蓝牙 LE 配件在 Xcode 中设置:

    enter image description here

关于iOS 蓝牙状态保存和恢复的重复问题 -25299,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34360660/

相关文章:

java - 通过蓝牙从 Java 服务器向 Android 客户端发送文本

ios - 截图在模拟器中有效,但在真实设备上失败

ios - iOS上的对讲机

c# - 将 UIImage 转换为流

android - Android 模拟器上的低功耗蓝牙

Pandas 在不同的列中删除重复的对数据

pandas - Pandas DF中的重复行

mysql - 删除重复用户mysql

ios - Swift 中的 Flurry 推送通知

ios - 如何降低 AWS on iOS App 的成本?