我想使用本地数据库,并且使用fmdb
库。
现在我想打开我的本地数据库,但是我收到了这个错误:
value of type stringByAppendingPathComponet
我的代码:
func openDatabase() {
let resourcePath = Bundle.main.resourceURL!.absoluteString
let dbPath = resourcePath.stringByAppendingPathComponent(dbFileName)
let database = FMDatabase(path: dbPath)
/* Open database read-only. */
if (!database.openWithFlags(1)) {
print("Could not open database at \(dbPath).")
} else {
self.database = database;
}
}