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

2

8

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?

Haggis answered 18/12, 2015 at 17:12 Comment(2)
What does happen when you name your queue differently (e.g. "com.mydomain.myapp.scanner1_fkou3h4t")?Bassett
Nothing seems to change, @MichaelDornerHaggis
B
1

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

Bassett answered 18/12, 2015 at 21:48 Comment(1)
what is the use of CBCentralManagerOptionRestoreIdentifierKey?Fraudulent
D
0

This may be related to known Keychain issue. (However, it is only a guess that this is Keychain coming from Security log in your app). OSStatus duplicate item appears when there is already a registered item with all attributes supplied along with the item. So what could happen in here is:

  1. keychain failed to delete last restoration id - item is left in keychain.
  2. register for the restoration with the same id
  3. keychain tries to save item.
  4. it returns duplicate item error
Dowdy answered 3/3, 2017 at 12:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.