1

My question is pretty simple and I did not find accurate answer so far.

I am using SQLite database in an application using a typical way (libsqlite3.dylib) and opening a file named FILE_NAME.sqlite, which I actually not placed in my xCode project. But still it is working and I am able to INSERT and SELECT records in database.

So, my question is, where that FILE_NAME.sqlite should be placed.

Using MAC OSX 10.8.4 iPhone SDK 6.x

mohsin.mr
  • 498
  • 1
  • 6
  • 21
  • Copy it from the app bundle into the documents folder: http://stackoverflow.com/questions/6545180/ios-copy-a-file-in-documents-folder – trojanfoe Nov 01 '13 at 07:39

2 Answers2

0

In sqlite, when you do something in a DB, if the DB doesn't exist sqlite create it for you. If you run this application in the iOS Simulator, you can find this file in Library/Application Support/iPhone Simulator/6.1/Applications/(app_id)/Documents where "(app_id)" is your application's id.

donadev
  • 439
  • 2
  • 7
  • 17
  • There is no directory of name "iPhone Simulator" under "Application Support". However, I found "iPhone Simulator" directory in Macintosh HD/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/SDKs/iPhoneSi‌​mulator6.1.sdk/ But where should I go after iPhoneSimulator6.1.sdk directory? – mohsin.mr Nov 01 '13 at 08:15
  • That's the incorrect directory. You have to search in Application Support folder.. – donadev Dec 08 '13 at 11:27
0

Actually,The files in app bundle cannot be changed after app installed.So you have to copy the FILE_NAME.sqlite to the document directory after app be installed.After that,you have to use the sqlite in the document directory.When you update the database in the xcode,you have to uninstall your app in the device or simulator.

hackcat
  • 19
  • 2