Support Topics Documentation Slack YouTube Blog

Flutter SDK: save function does not work on iOS

Hi, I am using backendless_sdk: ^1.1.2
I am trying to create new record on BLUser Table. But save function does not work on iOS, its working well on Android.
Nothing happen when I call
response = await backendless.Backendless.data.of(Constants.BLUSER_TABLE).save(user.toJson());
it stuck forever at that line.
In Android, its working well, the response is:
Screen Shot 2020-02-21 at 18.09.15

Here is my code and user.toJson()


Screen Shot 2020-02-21 at 17.57.51

Hi @long_nguyen

Thanks for the details. I will try to reproduce the issue and let you know once I find the problem.

Can you also specify you App ID?

Best Regards,
Maksym

my app id is 9EA6F9C0-7ACB-4204-B813-8A0881565F6F
Thanks

We checked it out, followed the steps you specified and the object saved successfully. Can you please provide the full code sample you use to create a new record on BLUser table?

Please also check if you ever reach the save function on iOS. I have the assumption that it’s never called and therefore object is never saved. Because the Backendless.data.of(table).save() method works correctly for both Android and iOS.

Best Regards,
Maksym

Thanks. I try to use Custome Classes instead. https://backendless.com/how-to-use-custom-classes-in-flutter-sdk/
It’s working now

Hi @long_nguyen

Glad to hear that. You can also check official documentation for Flutter SDK: Data Service API

Map approach should also works fine. Double-check the table name for this case. Maybe it’s misspelled.

Best Regards,
Maksym

I double checked. Table name is correct. Still dont know why. I resolved by use custom classes.

I have new issue when set Geo Relation on iOS. I followed this article: https://backendless.com/how-to-search-data-objects-by-distance-from-location/

Here my code:
Map user = {
“objectId”: userBLId
};

    int result = -1;
    try {
      result = await backendless.Backendless.data.of(Constants.BLUSER_TABLE).setRelation(user, "location:GeoPoint:1", children: [savedLocation]);
    } catch (exception) {
      Log.show(TAG, "updateBLUserLocation failed " + exception.toString());
      return Future.error(exception);
    }

In Android, it worked fine and return result = 1;
In iOS it stuck forever at this line result = await backendless.Backendless.data.of(Constants.BLUSER_TABLE).setRelation(user, "location:GeoPoint:1", children: [savedLocation]);

Here are user & savedLocation

Screen Shot 2020-02-25 at 11.37.37

Okay, let me check this out, @long_nguyen

Hi @long_nguyen

We couldn’t reproduce your issue. Can you please provide the minimal reproducible example of your problem?

Best Regards,
Maksym

I resolved by pass saved location as a Map: savedLocation.toJson()
Now it work fine on both Android & iOS. Thanks
result = await backendless.Backendless.data
.withClass()
.setRelation(user, “location:GeoPoint:1”, children: [savedLocation.toJson()]);

Hi @long_nguyen

Yes, the setRelation method accept children argument as List of Maps. We will update the method signature to be more transparent.

Best Regards,
Maksym

Yes, I think you should update documentations at here also. https://backendless.com/docs/flutter/data_set_relation_with_objects_flutter.html
String parentObjectId & List childrenObjectIds parameters are not correct now.

I’ve also created the internal ticket BKNDLSS-20710 for ‘method call get stuck forever’ problem.

Yes, it should throw exception when passing wrong arguments. Thanks for your support.

Hi @long_nguyen

You can check a new release v.1.1.3. We fixed the problem with methods stucking forever on iOS.

Best Regards,
Maksym