gpt4 book ai didi

ios - ViewController 中的 SQLite 错误 14

转载 作者:可可西里 更新时间:2023-11-01 00:39:01 26 4
gpt4 key购买 nike

import GRDB

class MyView: UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
do{
let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
}catch let error{
print(error)
}
}
}

错误是打印 SQLite 错误 14

什么是 SQLite 错误 14?

先用GRDB再先调用SqlLite

为什么会引发错误?

iOS 11.0 Swift 4.0 Grdb 2.10.0

构建到 Iphone8 模拟器

最佳答案

SQLite 错误代码 14 表示

Unable to open the database file.

您可以从那里获得描述:https://sqlite.org/c3ref/c_abort.html

对于你的问题,具体路径是什么?您是否对路径进行了硬编码?不要对路径进行硬编码,使用像

这样的模式
let path = NSHomeDirectory() + "/Documents/database.sqlite"

获取你的数据库路径,看看你的问题能否解决。

关于ios - ViewController 中的 SQLite 错误 14,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51419309/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com