iOS Core蓝牙:获取API MISUSE警告

Yog*_*rni 42 bluetooth ios core-bluetooth bluetooth-lowenergy ios7.1

我正在使用Core Bluetooth API在iOS 7中编写测试应用程序.当我测试应用程序时,我发现我收到以下警告消息:

TestBluetooth [626:60b] CoreBluetooth [API MISUSE]只能在开机状态下接受命令

后来我调试了app并发现,警告来自以下代码行:

[manager scanForPeripheralsWithServices:array options:scanOptions];
Run Code Online (Sandbox Code Playgroud)

那么有人可以告诉我为什么我在控制台中收到此消息?

我周围有蓝牙4.0 Android设备,但这个应用程序并没有发现它们作为外围设备.那么为什么它不发现蓝牙4.0 LE Android设备作为外围设备?

Eta*_*tan 69

你必须等到[-CBCentralManagerDelegate centralManagerDidUpdateState:]调用回调.然后,PoweredOn在开始扫描外围设备之前验证状态.

  • 这是一个简单但非常有用的评论.看起来很明显但事实并非如此.感谢那. (4认同)