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?

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/fa878f1f-42b2-4928-a1be-4cf9c9a4b9e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
2014-11-28 12:44:17.847 [INFO ] tapshotpro[5639:607] AppDelegate:140 - App 
started
2014-11-28 12:44:17.892 [INFO ] tapshotpro[5639:607] MigrationManager:29 - Last 
migration: 0
2014-11-28 12:44:17.892 [INFO ] tapshotpro[5639:607] MigrationManager:32 - 
Performing migration: 1
2014-11-28 12:44:17.909 [INFO ] tapshotpro[5639:607] TeamsViewController:35 - 
viewDidLoad
12:44:17.914| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: Async 
query tapshotpro/kCblViewTeamsByName...
12:44:17.915| CBLDatabase: Created CBLManager[0x7c8cfb50 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/6B2DF02F-EF73-49F5-93B5-F2BF447AD6AD/Library/Application
 Support/CouchbaseLite]
12:44:17.915| CBLDatabase: CBLManager[0x7c8a9eb0 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/6B2DF02F-EF73-49F5-93B5-F2BF447AD6AD/Library/Application
 Support/CouchbaseLite] created CBL_Server[0x7c8d0210] (with 
CBLManager[0x7c8cfb50 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/6B2DF02F-EF73-49F5-93B5-F2BF447AD6AD/Library/Application
 Support/CouchbaseLite])
12:44:18.111‖ CBLDatabase: Opening CBLDatabase[<0x7ae99250>tapshotpro]
12:44:18.111‖ CBLDatabase: Open 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/6B2DF02F-EF73-49F5-93B5-F2BF447AD6AD/Library/Application
 Support/CouchbaseLite/tapshotpro.cblite (flags=200006)
12:44:18.112‖ CBLDatabase: Begin transaction (level 1)...
12:44:18.112‖ ViewVerbose:     kCblViewTeamsByName last indexed at #0
12:44:18.113‖ ViewVerbose: #2: map "FB334942-4BA7-4823-A9F4-2B7E846425FE" for 
view kCblViewTeamsByName...
12:44:18.113‖ CBLDatabase: Commit transaction (level 1)
12:44:18.129| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: Will 
update after 0.285453 sec...
12:44:18.129| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: ...async 
query finished (0 rows)
12:44:18.129| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: ...Rows 
changed! (now 0)
2014-11-28 12:44:18.130 [INFO ] tapshotpro[5639:607] TeamsViewController:72 - 
teams query changed
2014-11-28 12:44:18.130 [INFO ] tapshotpro[5639:607] TeamsViewController:123 - 
teams live query updated
2014-11-28 12:44:18.133 [INFO ] tapshotpro[5639:607] TeamsViewController:89 - 
No team selected
2014-11-28 12:44:25.170 [INFO ] tapshotpro[5639:607] TeamViewController:41 - 
viewDidLoad
2014-11-28 12:44:34.180 [INFO ] tapshotpro[5639:607] TeamViewController:64 - 
savePressed
12:44:34.180| CBLModel: New team init
12:44:34.180| CBLModel: New team made new document
12:44:34.180| CBLModel: New team .type := "Team"
12:44:34.181| CBLModel: New team .name := "Warriors"
12:44:34.181| CBLModel: New team Saving <- {
    "_id" = "0EAF904F-CBAF-4BF1-836A-16B52A60D56D";
    name = Warriors;
    type = Team;
}
12:44:34.181| CBLDatabase: PUT rev={0EAF904F-CBAF-4BF1-836A-16B52A60D56D 
#(null)}, prevRevID=(null), allowConflict=0
12:44:34.181| CBLDatabase: Begin transaction (level 1)...
12:44:34.181| CBLDatabase: Commit transaction (level 1)
12:44:34.182| CBLDatabase: Added: {0EAF904F-CBAF-4BF1-836A-16B52A60D56D 
#1-aa9c2b95205510cacf5873b401ab4a55} (seq=3)
12:44:34.182| CBLDatabase: CBLDatabase[<0x7c8aae80>tapshotpro]: Posting change 
notifications: seq 3
12:44:34.182| CBLDatabase: CBLDatabase[<0x7ae99250>tapshotpro]: Notified of 1 
changes by CBLDatabase[<0x7c8aae80>tapshotpro]
12:44:34.182‖ CBLDatabase: CBLDatabase[<0x7ae99250>tapshotpro]: Posting change 
notifications: seq (3)
12:44:34.182| CBLModel: [name: Warriors, type: Team, _id: 
0EAF904F-CBAF-4BF1-836A-16B52A60D56D, _rev: 1-aa9c2b95205510cacf5873b401ab4a55] 
Saved as rev 1-aa9c2b95205510cacf5873b401ab4a55
2014-11-28 12:44:34.184 [INFO ] tapshotpro[5639:607] TeamViewController:76 - 
Saved: [name: Warriors, type: Team, _id: 0EAF904F-CBAF-4BF1-836A-16B52A60D56D, 
_rev: 1-aa9c2b95205510cacf5873b401ab4a55]
12:44:34.539| CBLModel: [name: Warriors, type: Team, _id: 
0EAF904F-CBAF-4BF1-836A-16B52A60D56D, _rev: 1-aa9c2b95205510cacf5873b401ab4a55] 
dealloc

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/fa878f1f-42b2-4928-a1be-4cf9c9a4b9e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
2014-11-28 12:40:49.593 [INFO ] tapshotpro[5537:607] AppDelegate:140 - App 
started
2014-11-28 12:40:49.610 [INFO ] tapshotpro[5537:607] MigrationManager:29 - Last 
migration: 1
2014-11-28 12:40:49.635 [INFO ] tapshotpro[5537:607] TeamsViewController:35 - 
viewDidLoad
12:40:49.641| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: Async 
query tapshotpro/kCblViewTeamsByName...
12:40:49.641| CBLDatabase: Created CBLManager[0x78e964f0 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/93172490-A955-4EB2-89BF-E37F59D850BA/Library/Application
 Support/CouchbaseLite]
12:40:49.641| CBLDatabase: CBLManager[0x79cb3600 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/93172490-A955-4EB2-89BF-E37F59D850BA/Library/Application
 Support/CouchbaseLite] created CBL_Server[0x78e96bb0] (with 
CBLManager[0x78e964f0 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/93172490-A955-4EB2-89BF-E37F59D850BA/Library/Application
 Support/CouchbaseLite])
12:40:49.653‖ CBLDatabase: Opening CBLDatabase[<0x79b3fbb0>tapshotpro]
12:40:49.653‖ CBLDatabase: Open 
/Users/jpaas/Library/Developer/CoreSimulator/Devices/58A0CA81-23B3-4B2D-B4BA-CF34D29DD597/data/Containers/Data/Application/93172490-A955-4EB2-89BF-E37F59D850BA/Library/Application
 Support/CouchbaseLite/tapshotpro.cblite (flags=200006)
12:40:49.654‖ CBLDatabase: Begin transaction (level 1)...
12:40:49.654‖ CBLDatabase: Commit transaction (level 1)
12:40:49.672| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: ...async 
query finished (0 rows)
12:40:49.672| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: ...Rows 
changed! (now 0)
2014-11-28 12:40:49.672 [INFO ] tapshotpro[5537:607] TeamsViewController:72 - 
teams query changed
2014-11-28 12:40:49.672 [INFO ] tapshotpro[5537:607] TeamsViewController:123 - 
teams live query updated
2014-11-28 12:40:49.675 [INFO ] tapshotpro[5537:607] TeamsViewController:89 - 
No team selected
2014-11-28 12:40:51.123 [INFO ] tapshotpro[5537:607] TeamViewController:41 - 
viewDidLoad
2014-11-28 12:40:54.475 [INFO ] tapshotpro[5537:607] TeamViewController:64 - 
savePressed
12:40:54.475| CBLModel: New team init
12:40:54.475| CBLModel: New team made new document
12:40:54.475| CBLModel: New team .type := "Team"
12:40:54.475| CBLModel: New team .name := "warriors"
12:40:54.476| CBLModel: New team Saving <- {
    "_id" = "E2651779-91E6-4700-9357-2209AF21E7ED";
    name = warriors;
    type = Team;
}
12:40:54.476| CBLDatabase: PUT rev={E2651779-91E6-4700-9357-2209AF21E7ED 
#(null)}, prevRevID=(null), allowConflict=0
12:40:54.476| CBLDatabase: Begin transaction (level 1)...
12:40:54.476| CBLDatabase: Commit transaction (level 1)
12:40:54.477| CBLDatabase: Added: {E2651779-91E6-4700-9357-2209AF21E7ED 
#1-4e233bdf49d013ecf0308fbb1fb731fd} (seq=3)
12:40:54.477| CBLDatabase: CBLDatabase[<0x79cb44b0>tapshotpro]: Posting change 
notifications: seq 3
12:40:54.477| CBLDatabase: CBLDatabase[<0x79b3fbb0>tapshotpro]: Notified of 1 
changes by CBLDatabase[<0x79cb44b0>tapshotpro]
12:40:54.477‖ CBLDatabase: CBLDatabase[<0x79b3fbb0>tapshotpro]: Posting change 
notifications: seq (3)
12:40:54.477| CBLModel: [name: warriors, type: Team, _id: 
E2651779-91E6-4700-9357-2209AF21E7ED, _rev: 1-4e233bdf49d013ecf0308fbb1fb731fd] 
Saved as rev 1-4e233bdf49d013ecf0308fbb1fb731fd
2014-11-28 12:40:54.479 [INFO ] tapshotpro[5537:607] TeamViewController:76 - 
Saved: [name: warriors, type: Team, _id: E2651779-91E6-4700-9357-2209AF21E7ED, 
_rev: 1-4e233bdf49d013ecf0308fbb1fb731fd]
12:40:54.480| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: Will 
update after 0 sec...
12:40:54.480| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: Async 
query tapshotpro/kCblViewTeamsByName...
12:40:54.480‖ CBLDatabase: Begin transaction (level 1)...
12:40:54.480‖ ViewVerbose:     kCblViewTeamsByName last indexed at #2
12:40:54.481‖ ViewVerbose: #3: map "E2651779-91E6-4700-9357-2209AF21E7ED" for 
view kCblViewTeamsByName...
12:40:54.481‖ ViewVerbose:     emit("warriors", 
{"name":"warriors","type":"Team","_id":"E2651779-91E6-4700-9357-2209AF21E7ED","_rev":"1-4e233bdf49d013ecf0308fbb1fb731fd","_local_seq":3})
12:40:54.481‖ CBLDatabase: Commit transaction (level 1)
12:40:54.482‖ ViewVerbose: Query kCblViewTeamsByName: Found row with 
key="warriors", 
value={"name":"warriors","type":"Team","_id":"E2651779-91E6-4700-9357-2209AF21E7ED","_rev":"1-4e233bdf49d013ecf0308fbb1fb731fd","_local_seq":3},
 id="E2651779-91E6-4700-9357-2209AF21E7ED"
12:40:54.482| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: ...async 
query finished (1 rows)
12:40:54.482| Query: CBLLiveQuery[kCblViewTeamsByName, mapOnly=YES]: ...Rows 
changed! (now 1)
2014-11-28 12:40:54.482 [INFO ] tapshotpro[5537:607] TeamsViewController:72 - 
teams query changed

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/fa878f1f-42b2-4928-a1be-4cf9c9a4b9e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to