Reputation: 1347
I can successfully scan all connectable bluetooth devices:
_manager?.scanForPeripherals(withServices: nil, options: [CBCentralManagerScanOptionAllowDuplicatesKey:true])
But when I try to scan from specific CBUUID my app does not discover the bluetooth device.
_manager?.scanForPeripherals(withServices: [CBUUID(string: "FFF1")], options: [CBCentralManagerScanOptionAllowDuplicatesKey:true])
I created a virtual device with LightBlue ios app with the same FFF1 service UUID, and 2. code is working as expected. But it does not discover a real bluetooth device having the same service UUID FFF1.
Note: All of the functionality, connection, discovering services, discovering characteristics, read & write working except searhing for specific CBUUID.
Upvotes: 1
Views: 1470
Reputation: 1059
I have checked your code in iOS13.5 .
You would have got solution. Thanks
//precomputed 128 bit value from the Notification API's 16 bit value: 0xFFF1
//static let serviceUUID = CBUUID(string: "0000FFF1-0000-1000-8000-00805F9B34FB")
_manager?.scanForPeripherals(withServices: [serviceUUID], options: [CBCentralManagerScanOptionAllowDuplicatesKey:true])
Upvotes: -1