问题
Is there any way to modify CBAdvertisementDataManufacturerDataKey
from CBPeripheralManager
? I understand I can get the CBAdvertisementDataManufacturerDataKey
from CBCentralManager
.
The reason I want to do this is because I want the peripheral to advertise a 10-byte value without resorting to having the central connect to it, discover services, and then reading a characteristic which would contain the 10-byte value.
回答1:
No, this is currently not possible as of iOS 7. The Manufacturer Data is reserved by Apple and is unmodifiable (at least on non-jailbroken devices). If you were writing the firmware for your own peripheral, this would not be a problem. But since the CoreBluetooth api is a layer above Apple's actual implementation of the iOS ble firmware, we face the limitations of what they actually expose. You may consider advertising you own custom service and displaying the same value you would have put in the manufacturer data, however.
来源:https://stackoverflow.com/questions/23771578/changing-cbadvertisementdatamanufacturerdatakey-from-peripheral