iOS 上的应用能否在 BLE 的设备信息服务中实现固件版本字符串特征

Can an app on iOS implement the Firmware Version String characteristic in Device Information Service in BLE

我想在 iOS 上创建一个 BLE 外围设备作为应用程序,并在设备信息服务中实现固件版本字符串特征。

当我这样做时:

deviceInformationService = CBMutableService(type: CBUUID(string: "0x180A"), primary: false)
deviceInformationService.characteristics = [
    manufacturerNameString,
    modelNumberString,
    firmwareRevisionString
]
peripheral.add(deviceInformationService)

调用 func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: Error?) 回调时出现错误:

Error Domain=CBErrorDomain Code=8 "The specified UUID is not allowed for this operation." UserInfo={NSLocalizedDescription=The specified UUID is not allowed for this operation.}

当我使用 Bluetooth Explorer 从 Mac 连接到 iPhone 并读取设备信息时,它显示

Manufacturer Name String = Apple Inc.
Model Number String = iPhone10,3

这不是我在 CBMutableCharacteristic 中设置的。而且固件版本字符串也不存在。

有没有办法实现固件修订字符串?

设备信息服务属于设备,而不属于您的应用。您的应用与所有其他应用和 OS 共享 BLE 堆栈,因此您不能像这样覆盖系统范围的特性。