简体   繁体   中英

How can i get Characteristic value in bluetooth peripheral in swift4?

  <CBCharacteristic: 0x281bc6100, UUID = FFF1, properties = 0x10, value = <500c0b62 00008f2c 10223344 55660000 00000000>, notifying = NO>

i want this value " <500c0b62 00008f2c 10223344 55660000 00000000>"

can any one help me ?

Try this

if(characteristic.value != nil){
            if let ASCIIstring = NSString(data: characteristic.value!, encoding: String.Encoding.utf8.rawValue) {
                characteristicASCIIValue = ASCIIstring
                print("Value Recieved: \((characteristicASCIIValue as String))")

            }
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM