couchbase-lite-ios icon indicating copy to clipboard operation
couchbase-lite-ios copied to clipboard

Swift Package Manager version of CouchbaseLiteSwift 3.1.3 crashes on `MutableDocument()`

Open ossus-lib opened this issue 1 year ago • 3 comments

When using CouchbaseLiteSwift 3.1.3 via SPM, there's a crash in litecore::LogLevel as soon as instantiating a MutableDocument. Xcode 15 on macOS Sonoma:

import CouchbaseLiteSwift

let doc = MutableDocument(id: "abc")     // < crash
Screenshot 2023-11-24 at 21 35 29

Attaching simple SPM test project. Open, let it resolve the dependencies, hit COMMAND + U to run the unit test and it crashes.

CouchbaseLiteTest.zip

ossus-lib avatar Nov 24 '23 20:11 ossus-lib

Seem like you have found a crack in the code that didn't use log before intializing log compontents. Currently we intializing log comment in the static intializer of the Database class as we assume that when using Couchbase Lite, Database will need to be first created. Therea are a few classes that can be used without accessing the Database first and MutableDocument is one of them. A workaround now is may be create a database first before using MutableDocument.

pasin avatar Nov 25 '23 02:11 pasin

That works indeed, thanks!

ossus-lib avatar Nov 25 '23 22:11 ossus-lib

I've created https://issues.couchbase.com/browse/CBL-5221 to track this

velicuvlad avatar Nov 28 '23 16:11 velicuvlad