In Xcode 4.1 Database file is not displaying in build file - iphone

Using xcode 4.1 I am developing an application which is having database integration. I am able to do all functions on firefox Sqlite Manager plugin. When I add data to firefox, the data is being added properly by query. But I am not able to find the database file in the build folder of my application.
How can I get this file from within the application and from where ?
I have to check that the data inserted from the application is properly inserted or not because at the time of selecting & displaying the data, the application crashes.
Thanks in advance for guiding me & solving this problem.

Run application in iphone simolator and then insert data and the see the sqlite file at the path
home>Library>Application Support>Iphone Simulator>simulator type(like 5.0)>Applications
this path have many folders. folders have application data of all installed applications in simulator. search for your application and the open
Documents folder
here you have your sqlite file which store all your inserted data
Sometimes folders are hidden. so please check for hidden files and folders
Hope this will help.

Related

Is it possible to view data stored in Core Data on a development iphone?

Is there a way to grab/view the coredata db (sqlite store) off of the development iphone through xcode or some other means? While I've been able to inspect the db created through the simulator on my mac, I'd like to validate what's on the actual phone (without having to create debugging views in the app, etc.) as i'm reading sensor data and storing it in coredata.
Yes you can using Xcode organizer.
Select you phone, then app, and you can export and import files from/to the sandbox
http://developer.apple.com/library/ios/recipes/xcode_help-devices_organizer/articles/copy_app_data_from_sandbox.html#//apple_ref/doc/uid/TP40010392-CH14-SW1
I'm not sure if there is an official way to do this but I use a piece of software called iExplorer formerly iPhone Explorer. http://www.macroplant.com/iexplorer/
You can then browse the Apps directory similar to the simulator and find your app and goto the documents directory and grab the sqlite file.
Hope this helps

Iphone SQLite problems

I'm developing an iphone application that read data through the sqlite.
I created a database through Terminal and added to the Xcode project.
I went back to the terminal and includes a new table in the file. sql. The problem is because my new queries do not see the new tables. This is kind a cache? How do i solve this problem?
Where is the SQLite file? Is it in your application bundle? Make sure you modify the version that's been copied to your iPhone Simulator folder (~/Library/Application Support/iPhone Simulator/) if you’re trying to modify the version running in the simulator.
What code do you use to create the database? Are you checking to see if it exists before copying it to your documents folder? If so, it exists and won't be copied.
You might try uninstalling your app from the simulator (or device) and reinstalling the app presumably with the new SQLite database. There's a few ways to get the old database in this situation.

Connecting CoreData to my App on an iPhone Device

I apologize ahead of time for what I'm sure is a complete newbie lapse. Running my iPhone app on iPhone simulator - no problem. But I loaded the app on an iPhone device for the first time and it appears as if the SQLite database I'm using (NSManagedObjectContext) isn't connected or didn't upload. The app installs but with no data. How do I get it all to upload and work on the device?
I appreciate any help.
lq
The first rule with Core Data is that you should never ever touch the store directly. It should be considered a black box and only accessed via the the Core Data APIs. Accessing the database directly is unsupported and can lead to data corruption.
What you should do instead is create a trivial desktop application (or command line is you are just importing from another source) and enter the data there. Once the data is entered then copy the sqlite file to your mobile application and include it in the bundle. That way you are accessing the file from Core Data. Since Apple can and does change the structure of that file without notice your application will be future proof.
update
If you have created a database using Core Data you can then take that sqlite file and add it to your Xcode project for your iPhone application. Xcode will then copy it into the app bundle when it compiles the project.
Looking a little deeper I found a link that answers my own question. So anyone with the same question, this solved the issue for me:
http://ablogontech.wordpress.com/2009/07/13/using-a-pre-populated-sqlite-database-with-core-data-on-iphone-os-3-0/

iPhone Application Version Upgrade will remove file stored in iphone memory?

Currently I have my application in which I am creating some plist file in User's Device and storing some local data.
Now, my confusion is that what happen if i will launch next version of my application and once user will upgrade my application's current version then what happen with that plist file which is stored in Users iPhone Device ?
Thanks in advance...
When users update application only the application bundle changes and other folders in application sandbox should remain intact.So if you store your data in Documents folder then it will persist after application update.
Edit: See Files Saved During Application Updates section in "Application Development Guide"
Nothing will happen to the files stored in the App's Documents directory. They will still be intact after the app is upgraded.

location of database created by the application

I have opened a database using sqlite3 in my application. When i run the application in the simulator, this database might be created and i'm playing with it. But now i need to know the location (to be accessed from ma mac) where this database is created. Surely it is not in the application folder as i'm not seeing it. I doubt it to be somewhere in the location where the simulator is installed. Anyone knowing the location. pls help me finding it.
If you're looking for the actual file on your Mac, try looking in this folder:
/Users/YOURUSERNAME/Library/Application Support/iPhone Simulator/User/Applications/
There should be a bunch of folders with long names. If you've recently built your app for the Simulator, order the folder by Date and the newest will be at the top. The folder contains a Documents folder, but you can also right-click on the app to "Show Package Contents", which might contain your database.sqlite file.