将CBPeripheral的UUID转换为字符串格式:

时间:2015-03-03 19:16:34

标签: objective-c bluetooth-lowenergy uuid core-bluetooth

我正在尝试将CBPeripheral的UUID转换为字符串格式:

CBPeripheral*         peripheral;

NSString *pUuid = (__bridge NSString *)(CFUUIDCreateString(nil, peripheral.UUID));

但我收到了这个错误:

Incompatible pointer types passing retainable parameter of type 'NSString *' to a CF functions expecting 'CFUUIDRef' (aka 'const struct _CFUUID *') type

1 个答案:

答案 0 :(得分:2)

根据{{​​3}}

peripheral.UUID自OSX 10.9起不推荐使用

要完成您要执行的操作,请使用:

[peripheral.identifier UUIDString]