I have the following class
written in Swift:
import UIKit
import CoreBluetooth
class vaBean: CBCentralManager, CBCentralManagerDelegate {
func centralManagerDidUpdateState(central: CBCentralManager!) {
println("didUpdateState")
switch (central.state) {
case .PoweredOff:
println("hardware is powered off")
case .PoweredOn:
println("hardware is powered on and ready")
case .Resetting:
println("hardware is resetting")
case .Unauthorized:
println("state is unauthorized")
case .Unknown:
println("state is unknown");
case .Unsupported:
println("hardware is unsupported on this platform");
}
}
}
Which I then create an instance of in my main ViewController
using the following code:
import UIKit
import CoreBluetooth
class ViewController: UIViewController {
override func viewDidLoad() {
println("bluetoothTest v1.00")
super.viewDidLoad()
var myBean: vaBean!
var myBeanMgr = vaBean(delegate: myBean, queue: nil)
}
override func didReceiveMemoryWarning() {super.didReceiveMemoryWarning()}
}
The code compiles OK but the function centralManagerDidUpdateState
is never called and I'm not sure why.