【问题标题】:iOS Bluetooth CBPeripheralManager Dictionary Key SupportiOS 蓝牙 CBPeripheralManager 字典键支持
【发布时间】:2019-05-03 02:35:42
【问题描述】:

CBPeripheralManager 文档中,startAdvertising 方法接收包含您要宣传的数据的字典。根据文档,CBPeripheralManager.startAdvertising 在其字典参数中只接受两个可能的键:CBAdvertisementDataLocalNameKeyCBAdvertisementDataServiceUUIDsKey

但是,在 Apple 的 Turning an iOS Device into an iBeacon 文档中,他们建议您能够传递从 CLBeaconRegionperipheralData 方法返回的字典。此方法返回的字典包含 1 个键值对,键名为“kCBAdvDataAppleBeaconKey”,值是proximityUUID、major、minor 和beacon 标识符。

从 peripheralData 方法返回的字典转储显示在这里: Dictionary Dump

我的问题是:如果 PeripheralManager.startAdvertisement 方法仅支持 CBAdvertisementDataLocalNameKeyCBAdvertisementDataServiceUUIDsKey?

【问题讨论】:

    标签: bluetooth-lowenergy core-location ibeacon core-bluetooth clbeaconregion


    【解决方案1】:

    最简单和最可能的解释是关于 CBPeripheralManager.startAdvertising 只接受两个键的文档是不准确的。在 iBeacon 支持发布后,文档可能根本就没有更新过。

    在相关说明中,我怀疑(但无法确认)该方法支持更多的密钥作为 private API。您必须反编译框架二进制文件才能弄清楚这些是什么。

    现实情况是,文档与添加到 API 的新功能不同步是很常见的,更不用说不公开支持的秘密行为的文档更常见。

    【讨论】:

    • 听起来是个合理的解释。我认为你是对的!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-27
    • 1970-01-01
    • 2013-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多