A simple question for everyone I think. I just begin to work with database for the Iphone. And so I create my database "external.sql" and I import it into Xcode.
I create a simple Navigation Base application and I try to display all from module_category but its not working, told me that the table does not exist. So I try to display in the console all tables inside my database, but it return me nothing
I have this:
2009-11-30 18:52:00.845 CategoryList[18458:20b] Display all tables in the database : ()
2009-11-30 18:52:00.859 CategoryList[18458:20b] *** Terminating app due to uncaught exception, reason: 'failed to execute st开发者_JS百科atement: 'SELECT * FROM module_category' with message: no such table: module_category'
Is there something special to do when importing a database into the project? Did I have to create an Object for all my tables before being able to display them?
Thank you,
P.S: I have possibility to send the test project if you don't understand.
I'm assuming here that you're using sqlite3. If so, it looks like the database file is not present on the iPhone at the path you're using to open it.
Check that the database file is being copied to the bundle by looking inside the .app bundle. To put the file in the bundle, add it to the Copy Bundle Resources build phase in Xcode.
Check that the database file is not corrupt. Use sqlite3 [path to the file inside the bundle]
to test your queries from the command line.
Check that you are using the correct path to open the database. Put a breakpoint on the line where you call sqlite3_open
and check that the file really is at that path.
精彩评论