We recently updated to the latest Flutter SDK version 7.3.3 from version 7.2.7 and I had to alter the call of Backendless.initApp(…) adding the ‘customDomain’ value and removing the secondary call of Backendless.setUrl(…) in order to get things working.
The updated SDK version did alleviate the login persistence issue for both the web and Android builds of my Flutter application, but the iOS application is still having similarly bad login behavior: if I open my iOS build after a fresh install, I can log in cleanly and the app is functional, but if I then close the app and re-open it, no Backendless API request seems to work - the user session is not kept alive and subsequent attempts to re-login or register fail.
In the logs I am seeing the following errors:
PlatformException(3840, The Data couldn’t be read beacuse it isn’t in the correct format., null, null)
Unhandled Exception: type ‘int’ is not a subtype of type ‘String?’
Has anyone seen this issue or know of a fix?
Can share with me detailed steps to reproduce this issue?
Using Flutter Backendless SDK 7.3.3:
- Configure flutter app to initialize Backendless in the following way:
- Configure Backendless login capability with stayLoggedIn = trrue
Backendless.userService.login(email, password, true)
- Build app to iOS device in a mode through which the app will persist beyond the Flutter debug session.
- Open app and log in.
- Close app.
- Open app again and find session is not maintained and API requests are unsuccessful.
Are you tried to initialize without custom domain?
@Nikita_Fedorishchev I have the same issue. But in step 6, when I call unitOfWork.create() API will throw the error “Field ‘ownerId’ doesn’t have a default value”. I set ownerId as not null in the Backendless console. Maybe the logged account session got an issue when close and reopen the app. It only happens on iOS. Android is working fine.
Nikita, we tried without the custom domain and it still will not initialize and fails.
Ok, thank you for information. I will investigate this issue.
I cannot fully reproduce this issue. I following this steps:
- initialize application;
- login user with stayLoggedIn true;
- call find request(successful);
- Close and reopen application;
- call find request again(successful).
Error in your case says that BackendlessException wait String? type but got int type. I found place where this error can be appears. I added cast to String. I released new version of flutter-sdk(7.3.4) with this fix, hope you guys don’t get this error again.
Please let me know about this. Thank you.
Best Regards, Nikita.
We are still seeing the issue even with the new flutter SDK. We will be doing more testing this evening when our full team is back together. Is there anything we can provide you with to help narrow down this issue further?
I tested on physical device on iOS system.
Maybe something was wrong in my test case?
Here is what we found with some more testing:
Looks like the problem is with the currently logged in user token being sent to with custom API requests.
Backendless.customService.invoke(_serviceName, “getMyUser”, null);
results in the following error:
Unhandled Exception: BackendlessException: No current user found, code = 1400
#0 Invoker.invoke. (package:backendless_sdk/src/modules/common/invoker.dart:32:11)
Indicating that the app’s cached user token is not being properly included in custom Backendless cloud code API requests.
Hello, @Matt_Olson you can try our new version of flutter-sdk(prerelease now) backendless_sdk 8.0.0-alpha.1 | Flutter Package.
I will check this issue in stable version in coming days.
Good news on our end, backendless_sdk 8.0.0-alpha.1 | Flutter Package resolved the issue. As this is a major release their are many other changes in the 8.0 that have effected our code that will need extensive testing before we would be comfortable using it.
With that being said are you able to provide us any type of timeline that the current SDK might be patched in order to resolve this issue? We have a new build with a lot of new features that we were hoping to publish this week or next week at the latest, obviously we need this resolved before we are comfortable publishing.
I will try to solve this problem this week for stable-sdk.
Best Regards, Nikita.
Appreciate that very much, thank you!
Just clarify: for Android this issue not reproducible?
Good morning Nikita, yes this problem has not occur with Android.
This issue has been fixed in 7.3.5 version. Let me know if problem still exists for you.
The issue has been resolved, thank you for your help with this.