Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

SQLite database on iPhone

I done all my development for my SQL on the simulator, and I have my app writing and reading from my DB seamlessly.

In fact, very few lines of code go quite far. In my Apple computer I am able to find my database and verify that all is working properly (under library/application support/iphone simulator/user/applications/myapp/documents)

BUT...

I know have moved the identical code to the iphone, and my app is UNABLE to read my database for its default configuration.

My code to find the DB in question comes from the Apple demos:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"MyDB.sql"];

Questions:
1) When I "build" my app for the iphone, and not the simulator, and my default DB is part of my project, is it copied to the iphone?
2) How can I see where it goes?
3) Why is it that what works on my simulator, does not work on the iPhone?

Thanks!

Posted on May 28, 2008 10:46 AM

Reply
16 replies

SQLite database on iPhone

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.