When I startAdvertising, my localName is long, more than 8 bytes. like @"123456789".
[_peripheralManager startAdvertising:@{
CBAdvertisementDataLocalNameKey: @"123456789",
CBAdvertisementDataServiceUUIDsKey: @[[CBUUID UUIDWithString:@"bbbb14c7-4697-aaaa-b436-d47e3d4ed187"]]
}];
When running on macOS 11.x though localName exceeds 8 bytes. But it can still be scanned.
{
kCBAdvDataIsConnectable = 1;
kCBAdvDataLocalName = 123456789;
kCBAdvDataRxPrimaryPHY = 0;
kCBAdvDataRxSecondaryPHY = 0;
kCBAdvDataServiceUUIDs = (
"BBBB14C7-4697-AAAA-B436-D47E3D4ED187"
);
kCBAdvDataTimestamp = "680712553.800874";
kCBAdvDataTxPowerLevel = 12;
}
But running after macOS 12.x, if localName exceeds 8 bytes, it will be completely ignored. In the scanned data, localName is empty.
{
kCBAdvDataIsConnectable = 1;
kCBAdvDataRxPrimaryPHY = 0;
kCBAdvDataRxSecondaryPHY = 0;
kCBAdvDataServiceUUIDs = (
"BBBB14C7-4697-AAAA-B436-D47E3D4ED187"
);
kCBAdvDataTimestamp = "680712744.108894";
kCBAdvDataTxPowerLevel = 12;
}
On macOS11.x, SCAN_RSP is utilized if localName exceeds 8 bytes,
while on macOS12.x, SCAN_RSP is always empty.
- Why are there differences between macOS11.x and macos12.x, is there any documentation?
- What is the maximum limit for localName? (On macOS 11.x, I verified it was 29 bytes
- Are there other ways to broadcast longer data?
Does anyone know why? This has bothered me for a long time...