Thanks Jens. I was just about to post this as a possible solution.
To ensure the database is not accessed while the background thread is working, I call stop on both pull and push replications beforehand and set the main thread's reference to the database to nil immediately after. On Monday, April 7, 2014 12:02:59 PM UTC-4, Jens Alfke wrote: > > > On Apr 4, 2014, at 11:26 AM, Scott Ahten <[email protected]<javascript:>> > wrote: > > Is there a safe way to push this work off to a background thread? > > > Yes, CBLManager has a -backgroundTellDatabaseNamed:to: method that will > run a block on the background thread that’s used for replication. The > gotcha with that method is that, since the background thread has its own > objects, you *must* use the CBLDatabase instance that’s passed into the > block instead of the one you use on the main thread. > > —Jens > > -- 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/2066cfb5-a6a1-4e63-9327-7a213b03dda3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
