我正在扫描硬件设备。 在前台时,我可以看到设备。 当我在前台开始扫描,然后转到后台,然后打开硬件 BLE,扫描停止,应用程序无法检测到硬件。
如果我将应用重新打开到前台,它会继续扫描并找到设备。
我已经设置了键:
<string>bluetooth-peripheral</string>
<string>bluetooth-central</string>
还有背景模式:
location updates
external accessory communication
uses BLE accessories
acts as BLE ACCESSORY
但什么也没有。系统不允许我在后台检测设备,只能在前台检测。
我错过了什么?
最佳答案
发现您必须设置您在后台查找的服务 ID,否则它将无法工作。 无论如何,后台扫描非常慢并且可能需要几分钟才能检测到!!
[_centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:DEVICE_INFO_SERVICE_UUID]]
关于ios - 进入后台时 BLE 扫描停止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27111338/