ios couchbase-lite 复制错误

ios couchbase-lite replication error

我正在开发一个 ios 应用程序,它使用 couchbase-lite 的复制功能。此复制从后台获取开始。在真实设备上进行了几次测试后,它似乎可以工作,但是当我尝试在锁定的设备上启动此复制时,会出现类似这样的错误

Failed to Load DB 'DBNAME': Error Domain=SQLite Code=23 "authorization denied" UserInfo={NSLocalizedDescription=authorization denied}



error opening!: 23

当我启动应用程序时,我执行以下操作来创建管理器

var error:NSError?
let options:CBLManagerOptions = CBLManagerOptions(readOnly: false, fileProtection: NSDataWritingOptions.DataWritingFileProtectionCompleteUntilFirstUserAuthentication)
let poptions:UnsafePointer<CBLManagerOptions> = UnsafePointer<CBLManagerOptions>.init(UnsafeMutablePointer<CBLManagerOptions>.alloc(1).initialize(options))
manager = CBLManager(directory: CBLManager.defaultDirectory(), options: poptions, error: &error)

有解决此问题的想法吗?仅当 iphone 被锁定时才会出现此错误!

谢谢。

问题已解决,请参阅下面 cblmanager 的正确初始化:

var error: NSError?
let cbloptions = CBLManagerOptions(readOnly: false, fileProtection: NSDataWritingOptions.DataWritingFileProtectionNone)
let cblpoptions=UnsafeMutablePointer<CBLManagerOptions>.alloc(1)
cblpoptions.initialize(cbloptions)
manager = CBLManager(directory: CBLManager.defaultDirectory(), options: cblpoptions, error: &error)