无法转换“NSUUID”类型的值?

问题描述

我想使用 retrieveperipheralsWithIdentifiers: 中的 CBCentralManager 方法。 在扫描时,我打印了每个外围设备的标识符。我正在寻找的是这个:

7E34D617-731F-616E-8C89-5729870CDD5E

我连接到这个外围设备,然后我连接回调我尝试执行以下操作:

let peripherals = centralManager?.retrieveperipherals(withIdentifiers: [NSUUID(uuidString:"7E34D617-731F-616E-8C89-5729870CDD5E")])
print("peripherals = ",peripherals)

但我不断收到编译错误说明:

Cannot convert value of type 'NSUUID?' to expected element type 'Array<UUID>.ArrayLiteralElement' (aka 'UUID')

在这里做错了什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)