And remember that your bundle is read-only so, as Scott suggested, you want to open it with SQLITE_OPEN_READONLY.
One more thing I just remembered (from doing this years ago)... you may also need to do this when you call sqlite3_open_v2:
add the SQLITE_OPEN_URI flag
pass the path as a file: URI rather than a raw path
append query parameter ?immutable=1 to that URI
This makes SQLite work correctly when the file is on a read-only disk, which is basically what your app bundle is. See these pages for more detail:
https://www.sqlite.org/c3ref/open.html
https://www.sqlite.org/uri.html#coreqp
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: