I am trying to initialize a central manager instance to make an app with Bluetooth connectivity.
This is part of my code:
class ViewController: UIVie
When you create a central manager, the central manager calls centralManagerDidUpdateState method of its delegate object. So you have to implement this delegate method to ensure that Bluetooth low energy is supported and available to use the central device. Like below:
func centralManagerDidUpdateState(central: CBCentralManager!){
println("CentralManager is initialized")
switch central.state{
case CBCentralManagerState.Unauthorized:
println("The app is not authorized to use Bluetooth low energy.")
case CBCentralManagerState.PoweredOff:
println("Bluetooth is currently powered off.")
case CBCentralManagerState.PoweredOn:
println("Bluetooth is currently powered on and available to use.")
default:break
}
}