0

I have downloaded a source code from https://github.com/NordicSemiconductor/IOS-nRF-Toolbox and I have added this to my project. Then I have created another class named "scanclassone" in my project and copied the codes in NORScannedPeripheral to scan scanclassone.

Then I have came with an error "Cannot assign value of type '[NORScannedPeripheral]' to type '[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!")
    }
}

I'm using Swift 4

  • Hello, welcome to SO. Which examples you tried? Could you give us some code you need to fix? Take a tour in the help center to ask better questions and therefore receive more useful answers! You can start here: [stackoverflow.com/help/how-to-ask](http://www.stackoverflow.com/help/how-to-ask) – Stuart.Sklinar Nov 23 '17 at 16:22
  • In what context does this error happen? You need to show the relevant code and explain what was happening and what you were trying to achieve. Otherwise it's just a random error message. – ADyson Nov 23 '17 at 16:34

0 Answers0