1

I am study swift5 for iOS using ble

I have to receive bytes from bluetooth device

I did receive characteristic

and I can get

var value = characteristic.value as! NSData //print result value => {length = 16, bytes = 0xaa0104050a000b0000000000000001a3}

but I want only bytes

so I did try print value.bytes

but this result is "0x000000028134d010"

how to get value.bytes????

p.s) I can't speak English is well.. sorry...

this is code

func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) { var value = characteristic.value as! NSData var data = value.bytes

  print("========= value => \(value)")
  print("========= data => \(data)")

}

0 Answers0