Loading Couchbase in background

#1

I’m trying to load Couchbase in background thread using GCD, but i get the error:

*** Assertion failure in -[CBL_FMDatabase beginUse], /Users/jenkins/jenkins/workspace/couchbase-lite-ios-builds/couchbase-lite-ios/vendor/fmdb/src/FMDatabase.m:967
 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '***** THREAD-SAFETY VIOLATION: This database is being used on a thread it wasn't  created on! Please see the concurrency guidelines in the Couchbase Lite documentation. *****'

In the loading code, i create the database, setup views and queries, start the push and pull replications.

How should it be done?

#2

From the warning message:

Please see the concurrency guidelines in the Couchbase Lite documentation.

http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/couchbase-lite/native-api/manager/index.html