Apple has a
known problem with KVO where, if you are receiving a notification on a different dispatch queue than they are triggered on, then the call to `observeValueForKeyPath` can happen while the object is deallocating. I caught my code doing this with live query observation (yay, unit tests!), and I'm trying to figure out how to prevent this situation from coming up in the future.
Am I correct in thinking that the live query is being updated on Couchbase-lite's queue, as apposed to my own serial dispatch queue where the live query was created? If so, then is it either possible or a good idea to run my call to addObserver on the same dispatch queue as the one where the live query is being updated?
Is there a better way to deal with this issue???
Thanks for the help!
Jordan