Open PaulEhrhardt opened 6 years ago
Further information
If add a delay of around 100ms before accessing the name
property i am finally able to read the name.
I noticed, that the name is only missing in the first advertisement for each peripheral received by scanForPeripheral
. This should definitely be fixed.
A workaround for now would be to use CBCentralManagerScanOptionAllowDuplicatesKey
to allow receiving multiple advertisements for one peripheral, and skipping the ones without a name.
scanForPeripherals(withServices: services, options: [CBCentralManagerScanOptionAllowDuplicatesKey: true])
.skipWhile({ (peripheral) -> Bool in
return peripheral.peripheral.name == nil
})
This is caused by the iOS vanilla API that may populate name at a later time depending on how it was obtained. The library does not know if a particular peripheral will have a name so I do not expect this issue to be fixable. There may be an additional API for name updates though I suppose. We will get back to this issue next week probably
Describe the bug
I have a Bluetooth device that advertises it's name. When running a scan/discovery with plain old CoreBluetooth i receive a
CBPeripheral
with the correct name in itsname
property.When using RxBluetoothKit for scan/discovery on the same device i receive a
nil
value for the name property.To Reproduce Steps to reproduce the behaviour:
RxBluetoothKit.ScannedPeripheral
, indicating the successful discoveryRxBluetoothKit.Peripheral
does not contain a value in thename
property. Also the wrappedRxBluetoothKit.Peripheral.CBPeripheral
in this object does not contain a value in its ownname
property.Expected behaviour The name property should contain the name of the device.
Please note the different behaviour using the CBManagerDelegate:
When performing a discovery via Apple's CoreBluetooth the
CBPeripheral
in thecentralManager(_:didDiscover:advertisementData:rssi:)
delegate callback has a valid value in it'sname
propertyEnvironment: