0

I am creating iphone app and requirement is as follows

1.i have fixed data base which have to be retain with the app not to create if it not exists.
2. i am using FM data base and i dont know how to make to keep data base with app .

Till now i use to use create if not exist query . It creates data base to particular path followed by and stores there. But will it retain data base with app even though running app in iphone rather than simulator.

Please make me to come out of this confusion.

Codo
  • 75,595
  • 17
  • 168
  • 206
Deepak
  • 177
  • 2
  • 11

1 Answers1

1

It creates data base to particular path followed by and stores there. But will it retain data base with app even though running app in iphone rather than simulator.

If you create the data base at runtime, then it will be stored in some user directory. This is intrinsically tied to the device where the app runs. Specifically, if you run your app in the simulator, then the DB will be created in the simulator OS filesystem (vs. the device filesystem if you run the app on the device). Then, when you run the app on your device, a new DB will be created there.

In this case, there is no relationship between the two. If you need that different devices share some information, you might use syncing, possibly using iCloud, to do that.

If your DB is static, as you seem to state, and you can create it before the first run of the app, then you could include it in the app bundle. This way, it would be tied to the app and it would be available on each device where the app is installed on to.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • You ment i need to copy manually created DB to where i am running the app(in xcode in app folder ). Thank you for the reply . – Deepak Nov 26 '12 at 09:21
  • It depends on what you are trying to do. You can include it in the bundle and then copy it into a user dir if you want to modify it (then different devices will have different DBs). If the db is never going to be changed by the app, you can leave it in the bundle. Try to describe more of what you are trying to do, if you need more help. – sergio Nov 26 '12 at 09:33
  • Initially all phones which installs have the same DB but the app gives freedom to modify existing DB. And that DB will not be transferable one phone to other. – Deepak Nov 26 '12 at 10:23
  • then yes, you can copy it to a user directory on first launch, then modify. See this question for details about how to copy the file over: http://stackoverflow.com/questions/6545180/ios-copy-a-file-in-documents-folder – sergio Nov 26 '12 at 10:38
  • Thank you very much for your precious time. I will go through the link. – Deepak Nov 26 '12 at 10:45