0

I am trying to implement a BLEHandler.

This is my code:

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")
        }
    }
}

I get an error: "Type 'BLEHandler' does not conform to protocol 'CBCentralManagerDelegate'"

I have the 'centralManagerDidUpdateState' method so I don't know what I've missed etc.

Giuseppe Lanza
  • 3,519
  • 1
  • 18
  • 40
B.Chok
  • 23
  • 3

1 Answers1

3

Method name is misspelled. Not cenrealManagerDidUpdateState, it should be centralManagerDidUpdateState

Try with...

func centralManagerDidUpdateState(_ central: CBCentralManager)
{

}
Adolfo
  • 1,862
  • 13
  • 19