0
我想實現一個BLEHandler。符合CBCentralManagerDelegate協議
這是我的代碼:
import CoreBluetooth
class BLEHandler : NSObject, CBCentralManagerDelegate {
override init() {
super.init()
}
func cenrealManagerDidUpdateState(central: CBCentralManager!)
{
switch (central.state)
{
case . unsupported:
print("BLE is unsupported")
case.unauthorized:
print("BLE is unauthorised")
case.unknown:
print("BLE is unknown")
case.resetting:
print("BLE is resetting")
case.poweredOff:
print("BLE is powered off")
case.poweredOn:
print("BLE is powered on")
default:
print("BLE default")
}
}
}
我得到一個錯誤: 「類型‘BLEHandler’不符合協議‘CBCentralManagerDelegate’」
我有「centralManagerDidUpdateState」的方法,所以我不要不知道我錯過了什麼等。