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
}
}
//...
}//#