V-Xtreme
V-Xtreme

Reputation: 7333

Path to created sqlite database different iPad Simulator

I have created one application which using sqlite database.For first some time i have tested it on to the simulator .It was working fine on the simulator it shows the path of document directory:

Library/Application support/iPhone simulator/5.1/Application/UUID/document/database.sqlite

But when i put my application on iPad my application suddenly exited when i tried to do database operation printing some other path where my database is not present. What i have to do with this ? Please give me some solution to overcome this problem.

Upvotes: 1

Views: 160

Answers (1)

J2theC
J2theC

Reputation: 4452

You need to dynamically look for the proper directory. Since this is a database, you might want to put it in the document directory. Here's a piece of code to take care of it:

[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]

Upvotes: 3

Related Questions