在背景上扫描外围设备 [英] Scan peripheral on background
本文介绍了在背景上扫描外围设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的BLE应用程序在后台运行并扫描外围设备,但委托方法centralManager:didDiscoverPeripheral:advertisementData:RSSI:
没有回调.我已经在Info.plist中为UIBackgroundModes
设置了值.为什么?该怎么解决?
My BLE app running on background and scanning peripheral but the delegate method centralManager:didDiscoverPeripheral:advertisementData:RSSI:
not callback. I've setted the value in Info.plist for UIBackgroundModes
. Why? How to solve it?
推荐答案
您无法在后台模式下扫描外围设备, 只需打开与外围设备的连接并保留对该外围设备的引用即可.
You cannot scan for peripherals in background mode, just open connection to peripherals and keep references to that peripherals.
之后您可以致电
[peripheral1 readRSSI];
并等待CBPeripheralDelegate回调
And wait for CBPeripheralDelegate callback
peripheralDidUpdateRSSI:
这篇关于在背景上扫描外围设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文