Reputation: 511
I am having trouble to write values to a BLE device. I translated this:
NSLog(@"Writing value for characteristic %@", interestingCharacteristic);
[peripheral writeValue:dataToWrite forCharacteristic:interestingCharacteristic
type:CBCharacteristicWriteWithResponse];
to Swift:
peripheral.writeValue("Writing value for characteristic", forCharacteristic: interestingCharacteristic, type: CBCharacteristicWriteWithResponse)
But I get the error Use of unresolved identifier 'CBCharacteristicWriteWithResponse'
I am new to iOs programming and tried manyfold ways to make it work but it just wouldn't happen. Can you help me please.
Upvotes: 0
Views: 1524
Reputation: 114773
You have combined the NSLog
statement and the writeValue
method into some sort of bizarre mashup.
What you want is
println("Writing value for characteristic \(interestingCharacteristic)")
peripheral.writeValue(dataToWrite, forCharacteristic:interestingCharacteristic, type: CBCharacteristicWriteType.WithResponse)
Upvotes: 1