Lee Armstrong
Lee Armstrong

Reputation: 11452

SQlite on iPhone READONLY

I use the following code to only read the database....

NSString *databasePath = [[[NSBundle mainBundle] resourcePath]  stringByAppendingPathComponent:@"lookup.db"];

    if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {

I get the error message below...

Mar 30 12:13:09 unknown sandboxd[418] <Notice>: LittleApp(129) deny file-write-data /private/var/mobile/Applications/E2112718-D0AB-46D4-8914-CC65EF262C0C/LittleApp.app/lookup.db

Now I know that the DB is in the mainBundle and if I want read/write access then to copy it across to the users documents but I only need read access and I have also had issues with people's phone's not copying across the DB properly, there are over 700,000 users of this app and it does show up!

So I suppose the question is, how can I suppress this notice by setting the query/open to Read Only?

Upvotes: 0

Views: 1107

Answers (1)

DarkDust
DarkDust

Reputation: 92336

Try using the sqlite3_open_v2 with SQLITE_OPEN_READONLY flag instead of sqlite3_open.

Upvotes: 2

Related Questions