-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to open database file #3
Comments
No "thanks in advance" necessary till you give me enough information to troubleshoot :) Please describe your exact setup and how/where your Database file is getting stored. Thanks! |
(If you are actually pasting that line in, you need to replace "path/to/db.sqlite3" to a resolvable path in your application.) |
My Setup is : New project -> single view application - > input product name,do not choose Use Core data(even choose it,still same error)->then choose a place to create. After that,I do as your screen dumped. I can run below code.Very strange.My new application is not in the same path of SQLite I try to write let db = Database("db.sqlite3"),but it still can't work. |
It's the first time to use SQLite,so I have no idea whether need to configure something else.:) |
I should probably have better explicit examples in the README, but the path needs to be a place your app can reach, e.g.: let path = NSSearchPathForDirectoriesInDomains(
.DocumentDirectory, .UserDomainMask, true
).first as String
let db = Database("\(path)/db.sqlite3") If you want to nest the database in a directory, you'll need to create one first. |
Cool,It can works now. |
Implement Upsert
when I try to use
let db=Database("path/to/db.sqlite3")
it pop a error said
fatal error: unable to open database file: file /Users/apple/Desktop/SQLite.swift/SQLite Common/Database.swift, line 336
Thanks for your help in advance
The text was updated successfully, but these errors were encountered: