Live query in CBL iOS app doesn't update on first app launch

48 views
Skip to first unread message

Julian Paas

unread,
Nov 28, 2014, 12:46:37 PM11/28/14
to mobile-c...@googlegroups.com
I have an iOS app that uses a few live queries and they all work quite well, except the first time the app is launched. My app is a basic CRUD app showing CBLModels in lists. The app starts with an empty table backed by a CBLUITableSource. Nothing else can happen until at least one CBLModel is added to that list. Any CBLModels I add are persisted, but the livequery backing the list never gets notified of any changes. But this ONLY happens on first launch. If I kill the app and restart it, the models I added appear in the list and the live query works from then on. I can add, delete, edit to my heart's content and all of those changes will be picked up by the live query. Its only the first time that it never works. I've turned on verbose debugging and I don't see any errors. I've attached two logs, one that shows what happens on first launch and another that shows what happens on the second launch.

I also tried launching the app once, then killing it and restarting before adding my first model, and it worked fine. What is happening here?
first_launch_log.txt
second_launch_log.txt

Julian Paas

unread,
Nov 28, 2014, 1:05:39 PM11/28/14
to mobile-c...@googlegroups.com
I found a workaround, but its still pretty weird. The workaround was to stop/start the live query after the query gets updated in the 
couchTableSource:updateFromQuery:previousRows: method. This seems to to allow it receive future notifications.

Jens Alfke

unread,
Dec 1, 2014, 11:38:01 AM12/1/14
to mobile-c...@googlegroups.com
Weird. Please file a bug report!

—Jens

Julian Paas

unread,
Dec 1, 2014, 12:06:20 PM12/1/14
to mobile-c...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages