![](/img/trans.png)
[英]iOS Corebluetooth advertising and scanning while app in the background
[英]iOS CoreBluetooth reconnecting while app in background
我的問題是“如果應用程序不在前台,我該如何重新連接到設備”? 我已經完成了我的研究,似乎連接到配對設備的最佳方式是通過retrivePeripherals:UUID。 一旦找到了回復的didRetivePeripherials,我就可以嘗試重新連接到設備。 當應用程序在后台運行時,我似乎無法做到這一點。
感謝幫助。
安德烈斯N.
bluetooth-central
后台模式 CBCentralManager
時使用CBCentralManagerOptionRestoreIdentifierKey
選項提供唯一標識符 - (void)centralManager:(CBCentralManager *)central willRestoreState:(NSDictionary *)state
delegate方法 NSArray *peripherals = state[CBCentralManagerRestoredStatePeripheralsKey]
獲取可恢復外設陣列NSArray *peripherals = state[CBCentralManagerRestoredStatePeripheralsKey]
connectPeripheral
你的方法CBCentralManager
提供每個外設恢復 閱讀“ 核心藍牙編程指南”中的更多詳細信息
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.