Reputation: 628
i'm currently migrating my project from swift 2.3 to swift 3 and I'm confuse with one thing. in swift 2.3 i can simply use
print("value \(characteristic.value!)")
and it would print the value i received value 61. But in swift 3 it would print something like 1 bytes. In order to get the value i have tried with the command
print("value \(characteristic.properties.rawvalue)")
With this command it return me the value. But why do Apple change this?
EDIT
i wonder if it is a bug? i'm using Xcode8.2.1 and swift 3 the command
characteristic.value!
would not return me the value.
Upvotes: 0
Views: 631
Reputation: 6459
characteristic.value
return a Data
type value. Here's how I get the data.
if let dataBytes = characteristic.value {
if characteristic.uuid == CBUUID(string: "FFF1") {
print(dataBytes)
} else if characteristic.uuid == CBUUID(string: "FFF2") {
print(dataBytes)
}
}
Upvotes: 1