IOS核心蓝牙:获得API误用警告 [英] IOS Core Bluetooth : Getting API MISUSE Warning

查看:540
本文介绍了IOS核心蓝牙:获得API误用警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的核心蓝牙API在iOS的7测试应用程序。当我测试应用程序,我发现,我收到以下警告消息:

I am writing a test app in iOS 7 with the Core Bluetooth API. When I am testing the application I found that I am getting the following warning message:

15 2014-04-28:52:09.400 TestBluetooth [626:60B] CoreBluetooth [API误用]只能接受命令,而在状态的动力

后来我调试应用程序,发现,预警是从下面这行code的到来:

Later I debugged app and found that, warning is coming from the following line of code:

[经理scanForPeripheralsWithServices:阵列选项:scanOptions];

因此​​,谁能告诉我为什么我在控制台收到此消息?

So can anyone please tell me why I am getting this message in the console?

有我身边的蓝牙4.0的Andr​​oid设备,但这个程序没有发现他们作为外围设备。那么,为什么它没有发现蓝牙4.0 LE Android设备作为外设?

There are bluetooth 4.0 android devices around me, but this app is not discovering them as peripheral device. So why it is not discovering bluetooth 4.0 LE Android devices as peripherals?

推荐答案

您必须等待,直到[-CBCentralManagerDelegate centralManagerDidUpdateState:]回调被调用,然后验证状态PoweredOn,您对外围设备开始扫描之前

You have to wait until the [-CBCentralManagerDelegate centralManagerDidUpdateState:] callback has been called, then verify that the state is PoweredOn, before you start scanning for peripherals.

这篇关于IOS核心蓝牙:获得API误用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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