flutter_reactive_ble
flutter_reactive_ble copied to clipboard
Example app is crashing when connecting/disconnecting same device
I've seen people reporting same issue which it says should be solved in 5.0.2 but the example app is crashing in the same way with the same error as before when I try to either connect again on the same device or connect and disconnect. And in my app it happens when I want to connect multi device
''' reactive_ble_mobile/ConnectTaskController.swift:16: Assertion failed
- thread #1, queue = 'com.apple.main-thread', stop reason = Assertion failed
frame #0: 0x0000000186801cf4 libswiftCore.dylib
_swift_runtime_on_report libswiftCore.dylib
_swift_runtime_on_report: -> 0x186801cf4 <+0>: ret libswiftCore.dylib_swift_reportToDebugger: 0x186801cf8 <+0>: b 0x186801cf4 ; _swift_runtime_on_report libswiftCore.dylib
_swift_shouldReportFatalErrorsToDebugger: 0x186801cfc <+0>: adrp x8, 335268 0x186801d00 <+4>: ldrb w0, [x8, #0x874] Target 0: (Runner) stopped. Lost connection to device. '''
This happens on my iPhone mini 12 with iOS 15.1.1.
I have seen this issue too
IOS app is crashed after the connecting with device so for handle the crash using scanStream.cancel(), but after doing this one of my readCharacteristic is not working fine i am not getting the battery status from device, but this is working fine with Android. According to me this error is because of scanStream.cancel() because in IOS app we used this and Android we did not use this.
I am sharing the readCharacteristic method which is not working in IOS, please help me out into this.
version : flutter_reactive_ble: ^5.0.2
if (Platform.isIOS) {
connectedBluetooth.value = true;
connectionForData();
_scanStream.cancel();
}
Future<void> connectionForData() async {
try {
flutterReactiveBle
.readCharacteristic(characteristicBattery)
.then((List<int> result) {
debugPrint("HERE ==>> connected bluetooth then");
for (var i in result) {
///read the battery status (byte code)
debugPrint("HERE ==>> connected bluetooth for");
batteryStatus(i);
}
});
}, onError: (Object error) {
CommonUtils.toastMesg(error.toString());
// Handle a possible error
});
} catch (e) {
debugPrint("HERE ==>> ${e.toString()}");
}
any updates? I forked the lib and did it by myself but when the app is going to update to support this solution?