简体   繁体   English

无法从iOS设备发现蓝牙外围设备或服务

[英]Unable to discover bluetooth peripheral or service from iOS device

I am attempting to scan for a bluetooth device using the CoreBluetooth framework. 我正在尝试使用CoreBluetooth框架扫描蓝牙设备。 The device is a prototype provided by a client. 该设备是客户端提供的原型。

I believe my implementation of the CBCentralManagerDelegate is correct, but I am never receiving the centralManager: didDiscoverPeripheral: advertisementData: RSSI: callback. 我相信我对CBCentralManagerDelegate实现是正确的,但我从未收到centralManager: didDiscoverPeripheral: advertisementData: RSSI:回调。 Even if I register for nil service UUIDs, which should fire discovery callbacks for all devices, nothing happens. 即使我注册了nil服务UUID(应该会触发所有设备的发现回调),也没有任何反应。

I would consider whether the bluetooth device might be defective, except here's the wrinkle... when I fire up the Bluetooth debugging application LightBlue on my iPad, the prototype device is listed, along with some services. 我要考虑的是蓝牙设备是否可能有缺陷,除非出现了皱纹……当我在iPad上启动蓝牙调试应用程序LightBlue时,列出了原型设备以及一些服务。 In fact, as soon as I use that app's 'clone' feature to reproduce the service from the iPad directly, my delegate callback fires. 实际上,只要我使用该应用程序的“克隆”功能直接从iPad复制服务,我的委托回调就会触发。

I can post some sample code but it really is boiler plate stuff (I believe). 我可以发布一些示例代码,但这确实是样板材料(我相信)。 Bluetooth experts: are there any obvious causes for the behavior I am experiencing? 蓝牙专家:我遇到的行为有明显的原因吗?

Some points to check: make sure you have set the delegate of your CCBCentralManager correctly. 需要检查的几点:确保正确设置了CCBCentralManager的委托。 If your device is bonded to iOS device I suppose didDiscoverPeripheral should not be fired, but in this case LightBlue app would not show any service at "Scanning for peripherals..." screen. 如果您的设备绑定到iOS设备,则我认为不应触发didDiscoverPeripheral ,但在这种情况下,LightBlue应用程序不会在“正在扫描外围设备...”屏幕上显示任何服务。

Good luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM