WHY have different data between ANDROID and IOS???
I tested both case relations 1:1 and 1:n
WHY WHY this is possible???
Here: my flutter code
And here IOS result:
And here ANDROID result:
WHY have different data between ANDROID and IOS???
I tested both case relations 1:1 and 1:n
WHY WHY this is possible???
Here: my flutter code
And here IOS result:
And here ANDROID result:
Hi. I’ve created the inner task [BKNDLSS-26349] for deeper investigation what can results in a such behavior.
But it will be helpful if you share the code-snippet of how you get the data (on pure Java and Flutter).
hi @oleg-vyalyh
I done change anything at java or swift
i just write with flutter and run two platform android and ios. It very clear
Ok, please share the small peace of code which reproduces the problem.
List<Map> data = await Backendless.data.of('Conversation').find(DataQueryBuilder())
Note: need in conversation have relation 1:1 or 1:n
If not sure you can set: relationsDepth = 2
Is the data you receive different? What you pointed out in the screenshots looks like log output. The values in the actual data should be the same UNLESS you have different security policy for Android and iOS API keys.
Hi @mark-piller
What your mean about “security policy for Android and iOS API keys.”, please expland me
I don’t know about that
Also you can set permissions for every table in the data section (look at the tabs on the top).
Here is my capture
Hello, @Minh_Tuan_Vu.
I have changed the permission for your application in the ‘ios Retrieve’ section - try again, everything should work now.
Best Regards, Nikita.
Hi @Nikita_Fedorishchev
Tks because of your support!
But prob still here, nothing different after your update
Please help me check this, because our project has accompanied your system to this stage… so on
No, i don’t set anything about permission.
I tried the find method to retrieve the data (in your application, with the “Conversation” table). In both cases, everything works well.
To understand the problem, could you please clarify if there is any data in your ‘data’ variable after executing the find method (before ‘fromJson’ method)?
You can check this in the debugger, or just print to the console using print().
Regards, Nikita.
okay, please wait, i will show you
Hi, @Nikita_Fedorishchev many thank for your waiting, please help me check it
Here is log on xcode
2021-09-22 13:58:08.082535+0700 Runner[54394:410109] flutter: [getConversations] query.pageSize: 20
2021-09-22 13:58:08.082740+0700 Runner[54394:410109] flutter: [getConversations] query.offset: 0
2021-09-22 13:58:08.082909+0700 Runner[54394:410109] flutter: [getConversations] query.relationsDepth: 2
2021-09-22 13:58:08.083280+0700 Runner[54394:410109] flutter: [getConversations] query.sortBy: [updated DESC]
2021-09-22 13:58:08.083467+0700 Runner[54394:410109] flutter: [getConversations] query.whereClause: users LIKE '%AAC1A2AC-DA92-4C95-80E6-1676CDEFD627%' AND lastMessageType IS NOT NULL
2021-09-22 13:58:09.592564+0700 Runner[54394:410109] flutter: [getConversations] data: [{lastMessageCreated: 1631792649000, lastMessageCustomProperties: null, updated: 1631792659000, name: , lastMessageType: contact, type: solo, ownerId: null, avatar: null, created: 1630204421000, objectId: 14655AE9-501A-40C8-A984-583458C74412, ___class: Conversation, lastMessageText: }, {lastMessageCustomProperties: null, ownerId: null, objectId: 0D2D7E6A-6D2A-4178-A3AA-41062180CBB9, name: , avatar: null, created: 1630812585000, updated: 1630825838000, ___class: Conversation, lastMessageType: text, lastMessageCreated: 1630825838000, lastMessageText: hi, type: solo}]
2021-09-22 13:58:09.593990+0700 Runner[54394:410109] flutter: [ConversationModel.fromJson] json: null
2021-09-22 13:58:09.594291+0700 Runner[54394:410109] flutter: [ConversationModel.fromJson] json[users]: null
2021-09-22 13:58:09.596922+0700 Runner[54394:410109] flutter: [ConversationModel.fromJson] json: null
2021-09-22 13:58:09.597763+0700 Runner[54394:410109] flutter: [ConversationModel.fromJson] json[users]: null
And here is code in flutter
Future<List<ConversationModel>> getConversations(
{int limit = 20, int offset = 0, String keywordSearch, bool justHaveMessage = true}) async {
try {
String and = '';
if (keywordSearch != null && keywordSearch.trim().isNotEmpty)
and = " AND name LIKE '%$keywordSearch%'";
String and2 = '';
if (justHaveMessage) and2 = " AND lastMessageType IS NOT NULL";
DataQueryBuilder query = DataQueryBuilder()
..pageSize = limit
..offset = offset
..relationsDepth = 2
..sortBy = ['updated DESC']
..whereClause = "users LIKE '%${AppPref.user.objectId}%'$and$and2";
print('[getConversations] query.pageSize: ${query.pageSize}');
print('[getConversations] query.offset: ${query.offset}');
print('[getConversations] query.relationsDepth: ${query.relationsDepth}');
print('[getConversations] query.sortBy: ${query.sortBy}');
print('[getConversations] query.whereClause: ${query.whereClause}');
List<Map> data = await Backendless.data.of('Conversation').find(query);
print('[getConversations] data: $data');
return ConversationModel.listFromJson(data);
} catch (e) {
return [];
}
}
//Model conversation
static List<ConversationModel> listFromJson(dynamic json) {
List<ConversationModel> data = [];
if (!(json is List) || json == null) return data;
json.forEach((e) {
data.add(ConversationModel.fromJson(e));
});
return data;
}
ConversationModel.fromJson(dynamic json) {
print('[ConversationModel.fromJson] json: ${json['users']}');
print("[ConversationModel.fromJson] json[users]: ${json['users']}");
avatar = json["avatar"];
objectId = json["objectId"];
name = json["name"];
type = json["type"];
users = AppUtils.parseListBackendlessUser(json["users"]);
updated = AppUtils.parseDateTime(json["updated"]);
created = AppUtils.parseDateTime(json["created"]);
if (json["property"] != null) property = PropertyModel.fromJson(json["property"]);
if (json["propertyUnit"] != null)
propertyUnit = PropertyUnitModel.fromJson(json["propertyUnit"]);
lastMessageType = json["lastMessageType"];
lastMessageText = json["lastMessageText"];
lastMessageSeen = AppUtils.parseListBackendlessUser(json["lastMessageSeen"]);
lastMessageUser = AppUtils.parseBackendlessUser(json["lastMessageUser"]);
if (json["lastMessageCustomProperties"] != null)
lastMessageCustomProperties = jsonDecode(json['lastMessageCustomProperties']);
lastMessageCreated = AppUtils.parseDateTime(json["lastMessageCreated"]);
}
Hello, @Minh_Tuan_Vu.
Thanks for your answer, it helped us find the problem. We will be releasing a fix shortly.
Best regards, Nikita.