I have an application that takes XML data and converts it into database tables. It uses SQLite3 and SQLCipher. If I hard code the path to save the database to put it in my Application Support folder, it works perfectly -- creates the file (with [fm createFileAtPath: newPath contents: nil attributes: nil];) and then opens it with SQLite, it creates the tables and populates them, everything works as expected.
If, however, I allow the user to save the database in the location of their choice, say in Documents or Downloads, the application creates the file (with createFileAtPath) but then when SQLite tries to create the tables, it fails with the error "unable to open database file" and error code 14 (which is a generic "couldn't open database" error.) Looking in the save directory, there is now a zero bytes file in that location.
Everything that I've seen online indicates that this is a permissions/security issue, but no one seems to point to a solution -- I went so far as to put in code to run chmod on the database and the folder that it's in, even that didn't help.
Your input is very much appreciated!