I'm writing a very basic App that shall scan the environment for peripherals that provide a specific service and displays the device IDs and the RSSI in a table view. Nothing special.
Here is what I'm trying:
extension BLEScanner: CBCentralManagerDelegate {
func centralManagerDidUpdateState(_ central: CBCentralManager) {
switch central.state {
case .poweredOn:
debug?.debug("Powered on")
central.scanForPeripherals(withServices: [CBUUID(string: "FD6F")],
options: [
CBCentralManagerScanOptionAllowDuplicatesKey: false
])
default:
break
}
}
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
let uuid = peripheral.identifier
debug?.debug("UUID: \(uuid) \(peripheral.name) \(RSSI)")
}
}
This code works as expected on devices running iOS12 and even on MacOSX, but when I run it on iOS13, no peripherals are being discovered.
I also tried other service UUIDs with the same result.
Isn't it possible to discover peripherals with specific services with iOS13 anymore?
Or could it be a device issue? I've installed iOS 13.5 on an iPad Pro (first generation), iOS13.6 on an iPhone 8 and iOS12.4 on an iPhone 6.