I'm just reading up on the CoreBluetooth module and am trying a simple playground. This is on a late 2012 iMac which according to the system report definitely has BLE support / it is registered under my developer account.
Is there anything additional I need to do to get it running in a playground? At the moment the code is just assigning the delegate and checking the state. It triggers the print in the unsupported case.
class BLEScanner: NSObject, CBCentralManagerDelegate {
var central: CBCentralManager?
override init() {
super.init()
let centralQueue = dispatch_queue_create("hi", DISPATCH_QUEUE_SERIAL)
central = CBCentralManager(delegate: self, queue: centralQueue)
}
func centralManagerDidUpdateState(central: CBCentralManager!) {
switch (central.state) {
case .PoweredOff: println("Powered off")
case .Unauthorized: println("Unauthorized")
case .Unknown: println("Unknown")
case .PoweredOn: println("Powered on")
case .Resetting: println("Resetting")
case .Unsupported: println("Unsupported")
default: break
}
}
}
let ble = BLEScanner()