1
votes

After updating to the iOS 9.1 pre-release, our legacy iOS app that uses a local app sqlite database is no longer able to read tables ("no such table: xxx" errors). I have updated the sqlite3.dylib reference via Link Binary with Libraries (/usr/libs/...), and it seems to be able to connect and open the database just fine, but the "no such table" error still persists. One odd thing: when browsing to the database file on the file system during debugging, I am able to open up the database in Firefox SQLITE and see the tables in question, and confirm they exist.

One other point: the target architectures being built are arm7 and arm64 - $(ARCHS_STANDARD).

Thank you in advance for any tips / help!

Update: Even though the filepath to the database during debugging in the simulator exists and contains a valid database containing tables, trying to SELECT * from sqlite_master returns no rows -- leading me to think it is creating a new database, even though the file path it uses to open the database is valid and contains a database.

1
You found an issue and you fixed it by updating the sqlite library. So what's your question? - rmaddy
Whoops -- should have clarified: I was just listing the steps I already took -- the problem of "no such table" still exists - Dave S
You can run a query to see if the table already exists: SELECT name FROM sqlite_master WHERE type='your_table' AND name='your_table_name'; Perhaps, the database is erased during iOS9 update. The database file you add to the project will be embedded in the main NSBundle ( [NSBundle mainBundle] ). - Vacca
@Vacca Thanks for the tip -- I saw another post suggesting this and used it to confirm the database was empty. I actually figured out what was going on and will comment when confirmed. - Dave S
Hi Dave. I have the same problem on ios9. Database are created but is empty. Have you found a solution? - doxsi

1 Answers

5
votes

The problem ended up being related to event firing. It seems in iOS 8x, when the viewDidLoad, the filepath to the database was being set. Then the database was being opened and selected from without issue. In the exact same code in iOS 9 something was firing off before viewDidLoad which was opening the database with a nil filepath string. Not being a dedicated iOS developer, I am not 100% sure what the difference is in the two OS versions and delegate / event firing, but I thought I would answer my own post in case others had this problem!