Advertises peripheral manager data.
- iOS 6.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 4.0+
- Core Bluetooth
An optional dictionary containing the data you want to advertise. The possible keys of an
advertisementdictionary are detailed in
CBCentral. That said, only two of the keys are supported for peripheral manager objects:
Data Local Name Key
Data Service UUIDs Key
When you start advertising peripheral data, the peripheral manager calls the
peripheral method of its delegate object.
Data advertising is done on a “best effort” basis, because space is limited and there may be multiple apps advertising simultaneously. While your app is in the foreground, it can use up to 28 bytes of space in the initial advertisement data for any combination of the supported advertising data keys. If this space is used up, there are an additional 10 bytes of space in the scan response that can be used only for the local name (represented by the value of the
CBAdvertisement key). Note that these sizes do not include the 2 bytes of header information that are required for each new data type. Any service universally unique identifiers (UUIDs) contained in the value of the
CBAdvertisement key that do not fit in the allotted space are added to a special “overflow” area; they can be discovered only by an iOS device that is explicitly scanning for them. While your app is in the background, the local name is not advertised and all service UUIDs are placed in the overflow area. The exact format of advertising and response data is defined in the Bluetooth 4.0 specification, Volume 3, Part C, Section 11.