Enum case' poweredon'不属于' CBManagerState'

时间:2017-09-13 08:10:12

标签: ios swift

您好我在使用" CBPeripheralManager"时遇到错误这是我的代码

扩展名BLEPeripheralManager:CBPeripheralManagerDelegate {

func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager){

    print("state updated\(peripheral.state)")

    switch(peripheral.state){

    case CBPeripheralManagerState.poweredOn:
        self.delegate?.blePeripheralManager(self, communicatorInitializationSuccessWithBluetoothState:BluetoothState.PoweredOn)
        break

    case CBPeripheralManagerState.poweredOff:
        self.delegate?.blePeripheralManager(self, communicatorInitializationFailWithBluetoothState: BluetoothState.PoweredOff)
        break

    case CBPeripheralManagerState.resetting:
        self.delegate?.blePeripheralManager(self, communicatorInitializationFailWithBluetoothState: BluetoothState.Resetting)
        break

    case CBPeripheralManagerState.unauthorized:
        self.delegate?.blePeripheralManager(self, communicatorInitializationFailWithBluetoothState: BluetoothState.Unauthorized)
        break

    case CBPeripheralManagerState.unknown:
        self.delegate?.blePeripheralManager(self, communicatorInitializationFailWithBluetoothState: BluetoothState.Unknown)
        break

    case CBPeripheralManagerState.unsupported:
        self.delegate?.blePeripheralManager(self, communicatorInitializationFailWithBluetoothState: BluetoothState.Unsupported)
        break

    }
}

Screen shot of error

0 个答案:

没有答案