BackendlessDataCollection - Count giving incorrect value?

Hi!

My testers are reporting a crash when removing the last item from a BackendlessDataCollection - this only seems to apply to persisted data when closing/reopening the application.

By whittling it down the above code gives the crash. The query builder returns one row. The remove call does remove the object from the collection. The count before and after the remove both return 1. So when the table thats using the collection reloads I get an index out of range error.

Any ideas - pointers?

Thanks
Pay

Hi Patrick,

I’ll check it.

Regards,
Olha

Thanks - if I can help by generating some example - do let me know.

(And call me Pat :+1:)

Okay Pat,

Could you please provide a simple example that reproduces this issue?

I’ll get back to you…

whats the best way to get this to you? Dropbox link?

Dropbox or Google Drive or you can attach the archive here.

Lets see if this works - TestBackendlessdataCollection.zip (33.4 KB)

1 - I (obviously!) removed AppId/ApiKey from AppDelegate
2 - Create a “testTable” table, with one column “testColumn”
3 - Put one row in there.
4 - Problem only seems to occur with already persisted data when opening the app, adding/removing to an existing collection object seems ok.
5 - Problem only seems to occur when dealing with the last row in the collection, multiple rows - the count seems to behave as expected.

If you need anything from me - ask away

Pat

Thank you,
I’ve created an internal ticket BKNDLSS-21568 and will check it as soon as possible.

Fixed, could you please check with v5.7.16?

Also please notice, that protocol name changed from Identifiable to BLIdentifiable to avoid the confusion with Swift’s Identifiable protocol.
Right now we are preparing the documentation for this class.

great - I’m on it and will get back to you shortly…

Hi - I upgraded (via cocoapods) to 5.7.16. Done nothing codewise to the test app and ran again - and getting an index out of range error when cellForRowAt runs on the first iteration.

Looking at the stack (attached) the totalcount seems right but the BackendlessCollection (highlighted row in the image) seems to have no values?

Did you change Identifiable to BLIdentifiable?

yes

Looking into it.

Unfortunately, I cannot reproduce it.

Here is the example you sent yesterday. I’ve changed Identifiable to BLIdentifiable and set my APP ID and API KEY. And everything works - here is the archive:

TestBackendlessdataCollection.zip (392.6 KB)

ok - let me triple check stuff my end in case I’ve done something dopey…

Sorry for delay - caught up in something else…

I forgot to clean my project!!! All looks good now, I’m doing a load more testing later so if anything comes up I’ll raise another thread. 5.7.16 brings up deprecations on get/setproperties - no dramas going through these I take it?

Thanks for the prompt looking into this…

Some get/set methods are deprecated (you can access properties using .) but they are still working.
More deprecations are coming in 6.0 but all of those methods are still working - just showing a warning for the future.
But some day these getters and setters will be removed from SDK (I assume not in the coming months) so it’s recommended to change those deprecated methods gradually.

Can I close this topic as solved?

yes - thanks again for your help

1 Like