2015-12-18 114 views
8

我在实例化CBCentralManager时遇到问题。从iOS控制台监视它时,我收到“重复问题”消息(它不显示在XCode控制台中)。iOS蓝牙状态保存和恢复的重复问题-25299

我试过更新队列名称恢复密钥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))

任何想法?

+1

是什么,当你的名字你的队列不同(例如'“com.mydomain.myapp.scanner1_fkou3h4t”')发生的呢? –

+1

似乎没有任何改变@MichaelDorner – marcelosalloum

回答

1

如果你想使用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

0

这可能与已知Keychain issue。 (但是,这只是猜测,这是Keychain来自应用程序中的安全日志)。 OSStatus重复项目在已经有注册项目时出现,其中所有属性与项目一起提供。因此,可能发生的情况如下:

  1. 钥匙串无法删除最后一个恢复ID - 项目留在钥匙串中。
  2. 寄存器为相同编号的恢复
  3. 钥匙串试图保存项目。
  4. 返回重复项错误