CoreBluetooth cannot find devices but iOS can

偶尔善良 提交于 2019-12-05 04:34:42

问题


I have a bluetooth barcode scanner whose spec says it's bluetooth 2.0, class 2. It is strange because my iPhone 5 (iOS7) could find and connect it. I thought iOS only connects BLE devices. But in my app I couldn't scan this device. I've no idea if this is because its bluetooth spec. I wish someone could give me some advices about how to connect this device in my app using CoreBluetooth or some other valid libs.

By the way my code is correct because I could find LightBlue app on another iPhone. My code is as following:

 // state is PowerOn
 [_centeralManager scanForPeripheralsWithServices:nil options:nil];

回答1:


I guess you detect it via Settings.app/Bluetooth? If that's so, that's a "classical" bluetooth device. It's not a Bluetooth Low-Energy one. If you want to connect to "classical" bluetooth device, you'll have to use ExternalAccessory.Framework. Bluetooth 4.0 contains two types of Bluetooth : Bluetooth "classical" and Bluetooth Low-Energy (as a fork). So that's why your iPhone can detect it.



来源:https://stackoverflow.com/questions/19998078/corebluetooth-cannot-find-devices-but-ios-can

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!