5

How to compare this? uuid and string cant compare

 func charValues()
 {
     let charValue = String(data: getCharacteristic.value!, encoding: 
       String.Encoding.ascii)!
     if getCharacteristic.uuid == "Manufacturer Name String"
     {
        self.lblManufactureName.text = charValue
     }
 } 
Deepak Tagadiya
  • 2,187
  • 15
  • 28

2 Answers2

6

There’s a uuidString property on CBUUID.

zoul
  • 102,279
  • 44
  • 260
  • 354
0

You need to compare UUID against UUID. Her you compare UUID against name.

CBPeripheral: 0x1c41066f0, identifier = 1CE90EC4-F208-ED69-A4A8-8CF804DDA0D3, name = fxc0c945fc40, state = disconnected

as you can see there is a difference. try comparing name to name or UUIDS

ironRoei
  • 2,049
  • 24
  • 45