This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to update BLE device name in ios swift !

I would like to update ble device name from device1 to user2. How i can do this in swift language . i m atrung to update by ios app.

is below way is right? but not able to update

let hexData = "user2"?.dataFromHexString()

peripheral.writeValue(data, forCharacteristic: characteric, type: CBCharacteristicWriteType.WithResponse)

Parents
  • If you are trying to update the Bluetooth low energy Generic Access Profile (GAP) device name. This property declaration is var name: String? { get } I'm not to familiar with swift, but since it says get, I assume you cannot set it. Also for objective C this is read only. So you need to create a characteristic on the peripheral and use this to update the name. On Android I belive you can write to the GAP device name directly.

Reply
  • If you are trying to update the Bluetooth low energy Generic Access Profile (GAP) device name. This property declaration is var name: String? { get } I'm not to familiar with swift, but since it says get, I assume you cannot set it. Also for objective C this is read only. So you need to create a characteristic on the peripheral and use this to update the name. On Android I belive you can write to the GAP device name directly.

Children
No Data
Related