CoreBluetooth无法找到设备,但iOS的能 [英] CoreBluetooth cannot find devices but iOS can

查看:229
本文介绍了CoreBluetooth无法找到设备,但iOS的能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个蓝牙棒code扫描仪的规范说,这是蓝牙2.0,2级。这是奇怪,因为我的iPhone 5(iOS7)可以找到并连接它。我以为iOS版只连接BLE设备。但是,在我的应用程序我无法扫描此设备。我不知道这是否是因为它的蓝牙规范。我希望有人可以给我如何使用CoreBluetooth或其他一些合法库在我的应用程序该设备连接一些建议。

顺便说一句我的code是正确的,因为我能找到的另一部iPhone LightBlue应用程序。我的code是如下:

  //状态在电源接通
 [_centeralManager scanForPeripheralsWithServices:无选项:无];


解决方案

我猜你通过Settings.app/Bluetooth检测呢?如果这是这样,这是一个经典蓝牙设备。这不是一个低功耗蓝牙之一。如果你想连接到经典蓝牙设备,你将不得不使用 ExternalAccessory.Framework
蓝牙4.0包含两种类型的蓝牙:支持蓝牙经典和低功耗蓝牙(叉子)。所以这就是为什么你的iPhone可以检测到它。

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];

解决方案

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.

这篇关于CoreBluetooth无法找到设备,但iOS的能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆