I need to solve this issue with my app. I try to scan the peripherals (Bluetooth devices) using the CBCentralManager from the CoreBluetooth in Xamarin.iOS, but when a peripheral is discovered it has an empty name sometimes, when I do the same from the iOS settings then it has a name. I'm not searching for a specific UUID.
CBCentralManager manager = new CBCentralManager(CoreFoundation.DispatchQueue.MainQueue);
manager.DiscoveredPeripheral += (sender, e) =>
{
if (e.Peripheral != null)
{
Debug.WriteLine($"DiscoveredPeripheral: {e.Peripheral.Name} - {e.Peripheral.Identifier} - {e.AdvertisementData}");
PeripheralsList.Add(e.Peripheral);
CustomDeviceDiscoveredAction(this, new CustomBTEDevice
{
DeviceName = e.Peripheral.Name,
DeviceAddress = e.Peripheral.Identifier.AsString(),
DeviceGuid = Guid.Parse(e.Peripheral.Identifier.AsString())
});
}
};
manager.ScanForPeripherals(null, new PeripheralScanningOptions
{
AllowDuplicatesKey = false,
});