我已将BLE外设连接到在后台运行的应用程序。
在另一个应用程序中,我调用retrieveConnectedPeripherals(withServices:)
来检索已连接外围设备的列表。
然后我按documentation的“讨论”部分所述致电connect(\_:options:)
,但永远不会调用centralManager(\_:didConnect:)
。
我保留了CBPeripheral对象。
答案 0 :(得分:0)
根据https://developer.apple.com/documentation/corebluetooth/cbcentralmanager/1518924-retrieveconnectedperipherals和https://developer.apple.com/documentation/corebluetooth/cbcentralmanager/1518766-connect链接的讨论。 " centralManager(:didFailToConnect:错误:)"调用而不是" centralManager(:didConnect :)"如果BLE外设已连接其他App。