mac osx 10.13 CoreBluetooth 框架上的 CBPeripheralStateDisconnecting 状态后,外围设备状态永远不会改变

Peripheral state never changes after CBPeripheralStateDisconnecting state on mac osx 10.13 CoreBluetooth framework

我已将 macOS 更新至 High sierra,并将 Xcode 更新至 9.2。我正在处理 BLE 设备连接/断开连接和读取数据。它在 Xcode 8.2 中运行良好,现在 CoreBluetooth 框架发生了变化。

外设状态新增了一个状态CBPeripheralStateDisconnecting。现在,我还需要从 CBPeripheralStateConnecting 状态取消与 BLE 设备的连接的功能。

我已经用cancelPeripheralConnection:方法取消连接了。在此方法之后,设备状态更改为 CBPeripheralStateDisconnecting,并且永远不会进入状态 CBPeripheralStateDisconnected。我尝试再次连接,但状态仍然没有改变。

简而言之,BLE 设备状态在 CBPeripheralStateDisconnecting 状态后永远不会改变。请问谁能推荐一个方法吗?

提前致谢。

我已经通过将 CBPeripheralStateDisconnecting 和 CBPeripheralStateDisconnected 状态视为相同来解决问题。在 CBPeripheralStateDisconnecting 上实现了与 CBPeripheralStateDisconnected 相同的流程,即再次向设备发送连接请求并成功。