I recently downloaded Xcode 8.0 and trying to run my previous project which uses core bluetooth.
I have enabled Use Legacy Swift Language Version in bu
The simplest approach is just to use the short-hand reference to the enumeration value:
func centralManagerDidUpdateState(central: CBCentralManager)
{
print("state is \(central.state.rawValue)")
if (central.state == .PoweredOn)
{
self.centralManager?.scanForPeripheralsWithServices([serviceUUID], options: nil)
}
else
{
// do something like alert the user that ble is not on
}
}
Now your code will compile without errors or warnings and works correctly on all targets