Multiple live queries in single view

HI,

I was trying to use multiple live queries in a single view but when started the queries, the error below was thrown.

Does couchbase lite supports multiple live queries at a time ? Are there any limitations?

‘NSInternalInconsistencyException’, reason: 'An instance 0x7873d720 of class CBLLiveQuery was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x78784460> (
<NSKeyValueObservance 0x78754170: Observer: 0x7b768d70, Key path: equipmentsQuery, Options: <New: YES, Old: NO, Prior: NO> Context: 0x469b78, Property: 0x787c4490>

The exception means what it says: you deallocated a CBLLiveQuery object, but you still have a key-value observer on it. It sounds like you’re only storing the query in a local variable, so it gets released when the method exits. Generally you want to store them in instance variables so they’ll remain alive.

1 Like