Yeah, but even if I make the copied CBLManager on the main thread, the models I have on the main thread won't be accessible through that background CBLManager. I'm wondering if there is a way to resolve that?
On Sunday, May 18, 2014 8:43:46 AM UTC-7, Pascal wrote: > > No, this is not good. The documentation I linked you to, more specifically > http://docs.couchbase.com/couchbase-lite/cbl-ios/#create-a-background-cblmanager, > mentions that you should NOT call `sharedInstance` on a background > thread. Use the example provided and see if that works for you. > > On Sunday, May 18, 2014 9:33:54 AM UTC-4, Ragu Vijaykumar wrote: >> >> So, this is safe to call even if all my models were created / accessed on >> the main thread? >> >> dispatch_async(dispatch_get_global_queue( >> DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ >> >> NSError* error; >> >> CBLDatabase* database = [[[CBLManager sharedInstance] copy] >> existingDatabaseNamed:@"mydatabase" error:&error]; >> >> [database saveAllModels:&error]; >> >> }); >> > -- 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/2e59fbbc-d1e2-4c91-b2c7-90a071f54085%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
