Open anhvu2503 opened 1 day ago
seems like it might be a new privacy restriction in iOS:
In FBP systemDevices
is a wrapper around retrieveConnectedPeripheralsWithServices
We use the Generic Access Service 0x1800
, but perhaps Apple has blocked this in iOS because it basically returns all devices.
Try forking FBP and looking for a specific service instead. We might need to update the API to be compatible with iOS 18.
else if ([@"getSystemDevices" isEqualToString:call.method])
{
// Cannot pass blank UUID list for security reasons.
// Assume all devices have the Generic Access service 0x1800
CBUUID* gasUuid = [CBUUID UUIDWithString:@"1800"];
// this returns devices connected by *any* app
NSArray *periphs = [self.centralManager retrieveConnectedPeripheralsWithServices:@[gasUuid]];
// Devices
NSMutableArray *deviceProtos = [NSMutableArray new];
for (CBPeripheral *p in periphs) {
[deviceProtos addObject:[self bmBluetoothDevice:p]];
}
// See BmDevicesList
NSDictionary* response = @{
@"devices": deviceProtos,
};
result(response);
}
if you fix this issue, please open a PR.
I don't plan to fix it myself.
if new api is needed, let's do a breaking change FlutterBluePlus.systemDevices({Guid? serviceUuid})
the serviceUuid will be required on iOS only, and ignored on Android.
Thank you for providing the information.
I will try this approach.
Have a great day!
Requirements
Have you checked this problem on the example app?
Yes
FlutterBluePlus Version
1.32.12
Flutter Version
3.19.5
What OS?
iOS
OS Version
IOS 18
Bluetooth Module
Nordic nRF52832
What is your problem?
When my phone is updated to the latest iOS 18 version, and I use
FlutterBluePlus.systemDevices
in my app to retrieve connected system devices, the result returns an empty list. However, when using a phone with an earlier version, everything works fine.Logs