Why the state of CBCentralManager is always Unsupported?

We are developing a new App for the iPad (iOS). The new App needs to access the Buletooth device. We expect to use CoreBluetooth framework to realize it. However, the state of the CBCentralManager instance is always Unsupported. Why? How to solve it?


We develop the App on the MaxBook Pro OS X EI Captan V10.11.4. The version of Xcode is V7.3.1.

class BluetoothService: NSObject, CBCentralManagerDelegate
{
var centralMgr: CBCentralManager?

func initializeCenral(){
centralMgr = CBCentralManager(delegate: self, queue: nil)
}

@objc func centralManagerDidUpdateState(central: CBCentralManager){
switch central.state{
case CBCentralManagerState.PowerOff:
print("Power Off")
case CBCentralManagerState.PowerOn:
print("Power On")
case CBCentralManagerState.Resetting:
print("Resetting")
case CBCentralManagerState.Unsupported:
print("Unsupported") // always in this state
default: break
}
}

//...

}//#

Accepted Answer

Are you testing this on the simulator?

Core Bluetooth apps require actual devices to run on, and cannot be run on the simulator.

Thank you very much. I created a new project for Command Line tool, and let it run the same codes on the local MacBook. In this case, the state of CBCentralManager becomes to PowerOn. It means that the CoreBluetooth Cannot run on any simulators.


I have to debug the core codes on my actual MacBook, and then debug the UI on the simulators.


Thank you very much again!

Why the state of CBCentralManager is always Unsupported?
 
 
Q