Testing without Internet connection

Hi,

I tried to do a test with a Flutter app and the Backendless.userService.loginAsGuest function. When I disconnect the iOS device from network and call the loginAsGuest function, my app crashes and I can’t catch the error with catchError or Try catch block, I was planning to check internet connection before calling the function, but I think the catchError must handle this kind of error, Am I right?

nsupported value: https://api.backendless.com/7E819124-27B5-85D2-FF77-9FB70FF33800/DAA8AD9A-12D3-484B-83FE-F4F77D460EF3/users/register/guest of type NSURL
Lost connection to device.
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e39f0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ad79b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e39c88 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff258a3cd2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 Flutter 0x000000010545cb4e -[FlutterStandardWriter writeValue:] + 1958
5 backendless_sdk 0x0000000107774a30 $s15backendless_sdk17BackendlessWtiterC10writeValueyyypF + 11280
6 backendless_sdk 0x0000000107774bc0 $s15backendless_sdk17BackendlessWtiterC10writeValueyyypFTo + 80
7 Flutter 0x000000010545ca80 -[FlutterStandardWr<…>


Backendless.userService.loginAsGuest(false)
.then((onValue) {
Navigator.pushNamed(context, ‘home’);
})
.catchError((onError) {
PlatformException platformException = onError;
print(platformException);
});

Hi @Dario_Castaneda

If you are working in Visual Studio IDE, please uncheck the Breakpoints ‘Uncaught Exceptions’ box (it will appear in a bottom left after the launch). This is a known issue for Flutter packages. Somehow the PlatformException is resolved as Uncaught Exception even though it is caught by the catchError block.
Don’t worry, the app won’t crash and the code inside the catchError block will be executed.

Best Regards,
Maksym

Thank you Maksym,

Yes, I already had unchecked both options, but I still having the error. The problem also happen in the physical device when wifi is powered off

In this video I use the bottom button to allow gest users, but when the code is called, the app crashes.

I can reproduce your issue on iOS and it’s definitely wrong behaviour. I’ve created the internal ticket BKNDLSS-21488. We will fix it as soon as possible.

Best Regards,
Maksym

great !

Thank you !

Hi @Dario_Castaneda

We’ve fixed this issue. Please check out the new version 1.1.8.
There was an issue when internet connection wasn’t available. Thank you for pointing out this problem!

Best Regards,
Maksym