iosbluetoothbluetooth-lowenergycore-bluetoothios7.1

iOS Core Bluetooth : Getting API MISUSE Warning


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:

TestBluetooth[626:60b] CoreBluetooth[API MISUSE] can only accept commands while in the powered on state

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

[manager scanForPeripheralsWithServices:array options:scanOptions];

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

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?


Solution

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