OStack程序员社区-中国程序员成长平台

标题: ios - BLE 设备在 cancelPeripheralConnection 后重新连接(如何忘记 BLE 设备?) [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:47
标题: ios - BLE 设备在 cancelPeripheralConnection 后重新连接(如何忘记 BLE 设备?)

我有一个 BLE 设备,它通过相当标准的用户界面(点击 UITableView 中显示的设备条目)选择后连接到 iOS 设备。

连接很简单——一些内部处理,然后调用 CBCentralManager 的 connectPeripheral(peripheral: options

需要“忘记”设备(这样 iPhone 就不会再次自动连接到它)。我调用了 cancelPeripheralConnection(peripheral,但设备仍会自动连接回手机。

调用cancelPeripheralConnection(peripheral方法后,如何阻止BLE设备自动重连?



Best Answer-推荐答案


没有办法使用代码忘记设备。您必须手动转到设置并忘记设备。

当蓝牙打开或设备启动连接时,系统将自动连接到配对设备。你是在 cancelPeripheralConnection 调用之后调用 connect 吗?

关于ios - BLE 设备在 cancelPeripheralConnection 后重新连接(如何忘记 BLE 设备?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44332860/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4