无法指定类型的值' [NORScannedPeripheral]'输入' [第三]'

时间:2017-11-23 13:02:50

标签: bluetooth connection bluetooth-lowenergy swift4 xcode9

我已经从https://github.com/NordicSemiconductor/IOS-nRF-Toolbox下载了源代码,我已将其添加到我的项目中。然后我创建了另一个名为" scanclassone"在我的项目中并复制了NORScannedPeripheral中的代码 扫描scanclassone。

然后我发现错误"无法分配类型' [NORScannedPeripheral]'输入' [scanclassone]'

func centralManagerDidUpdateState(_ central: CBCentralManager) {
    guard central.state == .poweredOn else {
        print("Bluetooth is porewed off")
        return
    }

    let connectedPeripherals = self.getConnectedPeripherals()
    var newScannedPeripherals: [NORScannedPeripheral] = []
    connectedPeripherals.forEach { (connectedPeripheral: CBPeripheral) in
        let connected = connectedPeripheral.state == .connected
        let scannedPeripheral = NORScannedPeripheral(withPeripheral: connectedPeripheral, andIsConnected: connected )
        newScannedPeripherals.append(scannedPeripheral)
    }
    peripherals  = newScannedPeripherals
    let success = self.scanForPeripherals(true)
    if !success {
        print("Bluetooth is powered off!")
    }
}

我使用的是Swift 4

0 个答案:

没有答案