I am beginner in swift development. I was working on BLE based application. Today I updated Xcode 8, iOS 10 and convert my code to swift3. Then some of my syntax are need to convert. After fixing this , I found one issue on CBCharacteristic.
Issue
Inside didUpdateValueforCharacteristic , I can get updated CBCharacteristic object. If I print out whole object, it show correctly. -> value = <3a02> When I retrieved value from CBCharacteristic , characteristic.value -> 2bytes (size of this value)
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?)
{
if (characteristic.uuid.description == LED_WAVELENGTH_CHARACTERISTIC_UUID)
{
print("Characteristic - \(characteristic)")
print("Data for characteristic Wavelength - \ (characteristic.value)")
}
}
Log Result :
Characteristic - <CBCharacteristic: 0x1742a50a0, UUID = 2C14, properties = 0xE, value = <3a02>, notifying = NO>
Data for characteristic Wavelength - Optional(2 bytes)
PS : This code is completely working fine on previous version.
Thanks for attention and hope someone can help me to fix this issue.