Sqlite database crash

Recently I set up a SQLite database for an iPhone application using this great little browser.

Reading from the database was fine (using System.Data.Sqlite.Dll is a breeze), but every time I tried to write to the database it was crashing the app. After much debuging & un/commenting of code I finally remembered that the directory of the main application bundle is read-only, and that is where I had the database! Thus on first run after installation, I now copy the blank database to the “Documents” directory and use it from there.

It was a silly mistake but I hope this helps others, because the MonoTouch framework was not throwing an exception, and when the app just crashes on you it’s difficult to determine what’s going wrong.