CoreBluetooth中不允许使用广告密钥“Manufacturer Data” [英] The advertisement key 'Manufacturer Data' is not allowed in CoreBluetooth

查看:1254
本文介绍了CoreBluetooth中不允许使用广告密钥“Manufacturer Data”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用核心蓝牙框架。我正在尝试使用此框架创建外围设备。我的外围设备通过以下方式宣传数据:

I am working with the core bluetooth framework . I am trying to create the peripheral using this framework . My peripheral advertise the data using :

manager=[[CBPeripheralManager alloc]initWithDelegate:self queue:nil];
[manager startAdvertising:dictionary];

这里我传给广告的字典是:

here the dictionary that I am passing for the advertisement is :

NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
                                    @"name", CBAdvertisementDataLocalNameKey,@"some other data",CBAdvertisementDataManufacturerDataKey,nil];

当我运行应用程序时收到警告:广告键'制造商数据' CoreBluetooth中不允许

when I am running the application I getting the warning :The advertisement key 'Manufacturer Data' is not allowed in CoreBluetooth

我没有使用密钥 CBAdvertisementDataManufacturerDataKey发送其他一些数据位于中心位置。我得到了中心的名字。那么如何将一些其他数据与广告数据一起发送?

and I am not getting "some other data " which I have sent using the key CBAdvertisementDataManufacturerDataKey at the central side . I am getting the name at the central side. So how can I send the some other data with the advertising data ?

推荐答案

作为 CBPeripheralManager 文档说明:


包含您要宣传的数据的可选字典。在CBCentralManagerDelegate协议参考中详细说明了advertisementData字典的可能键。 也就是说,外围管理器对象只支持两个密钥:CBAdvertisementDataLocalNameKey和CBAdvertisementDataServiceUUIDsKey

那些密钥仅适用于iOS设备处于中央模式且正在发现外部设备(即只读)的情况。在外围模式下运行时,我不知道为什么会出现这种限制,您可能会尝试在其上提交错误报告。

Those keys are only applicable when the iOS device is in central mode and is discovering outside peripherals (i.e. read-only). I have no idea why this restriction is in place when operating in peripheral mode, you might try filing a bug report on it.

这篇关于CoreBluetooth中不允许使用广告密钥“Manufacturer Data”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆