Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

iphone - The advertisement key 'Manufacturer Data' is not allowed in CoreBluetooth

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];

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

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As the CBPeripheralManager documentation on startAdvertising states:

An optional dictionary containing the data you want to advertise. The possible keys of an advertisementData dictionary are detailed in CBCentralManagerDelegate Protocol Reference. That said, only two of the keys are supported for peripheral manager objects: CBAdvertisementDataLocalNameKey and CBAdvertisementDataServiceUUIDsKey.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...