2015-12-18 110 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. 返回重複項錯誤