Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Bluetooth State Preservation and Restoration's DUPLICATE ISSUE -25299

I am having an issue when instantiating my CBCentralManager. I get a "duplicate issue" message when monitoring it from the iOS console (it does not show in the XCode console).

I've tried updating the queue name and the restoration key id without success. This is how I instantiate my Central Manager:

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

And those are the errors I am getting:

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))

Any ideas?

like image 524
marcelosalloum Avatar asked Dec 18 '15 17:12

marcelosalloum


1 Answers

If you want to use the CBCentralManagerOptionRestoreIdentifierKey, you must

  1. implement the method

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

    from CBCentralManagerDelegate, and

  2. use the background mode Uses Bluetooth LE accessories set up in Xcode:

    enter image description here

like image 81
Michael Dorner Avatar answered Sep 27 '22 21:09

Michael Dorner