GithubHelp home page GithubHelp logo

Unable to open database file about squeal HOT 4 CLOSED

nerdyc avatar nerdyc commented on July 27, 2024
Unable to open database file

from squeal.

Comments (4)

nerdyc avatar nerdyc commented on July 27, 2024

Did you ever resolve this issue? I wasn't able to reproduce it myself.

If so, you can also provide the error: parameter which should describe why the database couldn't be created.

from squeal.

tyczj avatar tyczj commented on July 27, 2024

I am having a similar problem, I have a custom init function for a class that makes sure there is a table and database every time an instance it created of that class. in my init method I have the following code

path = "images.sqlite3"
var err:NSError?
var db = Database(path: path!,error:&err) 

db is always nil so no tables get created, error reports back saying error NSError? domain: "sqlite3" - code: 14 0x00007f866b4608f0

all this is being tested on the simulator if that matters any

from squeal.

tyczj avatar tyczj commented on July 27, 2024

just doing some more debugging and it must be something with my path because a database gets created in memory just fine. does the path have to be something else besides a simple "name.sqlite3"?

UPDATE:

I think I found my problem at least, I had to get the documents directory and create it in there like this

var paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true);
path = paths[0].stringByAppendingPathComponent("images.sqlite3")

I just use that path and the database created just fine and I was able to continue

from squeal.

ijpe avatar ijpe commented on July 27, 2024

I have the similar problem, i use the top code and work fine

from squeal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.