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

Transform CBPeripheral's UUID to string format :

我正在尝试将 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

peripheral.UUID 从 OSX 10.9 开始弃用 Apple Documents

要完成您想要做的事情,您可以使用:

[peripheral.identifier UUIDString]