Updating Sqlite DB on iPhone Applliction - iphone

i'm developing an iphone app that uses local Sqlite3 DB; i would like to add an "Update data" menu voice that checks whether a new sqlite db version is found on my site and, if true, downloads file to the device. Data can change very often, so i'm asking if it is possible in some way without passing from the AppStore.
If yes, how can it be implemented?
Thanks in advance.
Grettings !
c.

You can download a sqlite file on app launch and switch it out easily in the code. Of course if the schema changes then thats a bigger problem but if its just data then it should be straightforward.

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

How do I download an sqlite database from an app on my iPhone?

I made an iPhone app that allows data entry. Over the past month I have been using it and input a lot of data that is now only on my iPhone in the sqlite database used by the app. I want to get the data off my phone now and store it somewhere else.
Is there anyway to access the sqlite database on the iPhone? If so can this data be updated externally or would the database need to be "re-embedded" and copied back over to the iPhone at build?
Try the iPhone Backup Extractor.
http://www.iphonebackupextractor.com/
If it is a development version, you can download data in Xcode. Plug in your device and find it in the area you do provisioning. Look for your app icon and there's a download button.

need to include a prepopulated coredata compatible sqlite db with app: here is my strategy How to implement?

So after doing a LOT of research on the web. I figured the best way to ship my app is to ship it with a sqlite db that is generated by coredata application.
Now to go about it I have decide that the following needs to be done:
1) Convert the data into a CSV format
2) Create a Coredata Mac application on my desktop
3) Parse the csv file and feed the contents to the coredata application on my mac and save as sqlite db.
4) Since the coredata model on the mac and iPhone is the same the underlying sqlite db will be compatible.
5) Include the sqlite db that was generated by my mac app with the iphone app.
So the question then is:
To create a mac app where do I start?
So far these are the steps I can think of:
1) Create a Mac app in XCode with Core data
2) create the "schema" on the coredata model that maps to the CSV file data
--??? This is where i get stuck!!
What next ??
Can someone help me please?
I cannot find any resources on the web for this or Im searching with the wrong keywords
Thanks a lot!
I did the exact same thing you wanted except I created a second target in my iPhone app that parses the csv and writes it out to core data. Run it in the simulator, you can find the sqlite file in
/"home"/Libary/Application Support/iPhone Simulator/5.0/Applications/"the app"/Documents
This way everything is kept in one project.
I have done a similar thing. I generated the CoreData db in the app with an #ifdef section that generated the db. That seemed simpler than creating a separate Mac application.
If you need to change the CoreData db in the app just copy it to the Library or Documents directory on initial startup. The only gotcha was that I had to change the db extension in the app so that Xcode would not make changes during compile/archive.

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/