XCode Not Copying Database
Posted on 2009-12-18
I've got an iPhone app that uses a SQLite database. USED to work, until I built for distribution. Now it's not working anymore. It can FIND the database, and it can OPEN it, but can't READ from it.
1) I added the database as an "existing file" to the resources directory of my project.
2) I checked the checkbox "Copy this file's contents" in the popup when you add a file.
3) I double-checked the original database before I copied it into the resource directory... 31M.
4) I build the project.
5) I checked the application directory for the build, and found that a file had been created that was the same name as my database file, but it was empty... zero K in size. No contents.
6) When I ran the application, it found the database, and did an OPEN successfully... but when I tried to execute a "sqlite3_prepare_v2" statement, it returned a SQLITE_ERROR, which indicates that it can't read/find the database.