brand new here.
The Tl;dr: Can an iOS device advertise a CB advertisement (CBAdvertisementDataServiceUUIDsKey and/or CBAdvertisementDataLocalNameKey) that can be scanned for by another iOS device?
I believe my question is fresh based on deprecations and changes to CoreBluetooth and CoreLocation in the later versions of iOS. Also, for now, I'm only referring to "foreground" ops.
From what I have read and tested, a peripheral can transmit a Beacon Region (unique Proximity UUID, major and minor (but notably without the "identifier")) using CL. And with CB, a peripheral can also "advertise" either of two small additional amounts of data: CBAdvertisementDataServiceUUIDsKey and CBAdvertisementDataLocalNameKey.
What I've not been able to achieve is having the device (e.g. iPhone) scan using CB for either of these additional keys, nor as I mentioned the optional "identifier" using either CL or CB.
The only option to specify a scan requires a CBUUID, but an undiscovered iOS peripheral cannot technically advertise that:
central.scanForPeripherals(withServices: [CBUUID]?, options: [String : Any]?)
It seems the following would work but it doesn't seem the advertisementData includes the keys above, even as [String : Any]:
func centralManager(_ central: CBCentralManager,
didDiscover peripheral: CBPeripheral,
advertisementData: [String : Any],
rssi RSSI: NSNumber){
//code
}
Any help/answers here would be appreciated. Thanks!
nil
as the scan parameter to discover all peripherals. None of this has changed for at least 3 versions of ios – Paulw11