The run method in CBLQuery (iOS CouchbaseLite1.0.4) get a error

CBLQuery* query = [_database createAllDocumentsQuery];
query.allDocsMode = kCBLAllDocs;
CBLQueryEnumerator* result =  [query run:nil];

I am getting the following error on startup:

*** Assertion failure in -[CBL_FMDatabase beginUse], /Users/jenkins/jenkins/workspace/build_cblite_ios_104-community/couchbase-lite-ios/vendor/fmdb/src/FMDatabase.m:967

That error indicates you are accessing the query on the wrong thread (it needs to be run on the same thread that the database was created on). You should see a message like this as well:

***** 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. *****