Iphone SQLite problems - iphone

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.

Related

iPhone SQLite Database not updating

I just updated my sqlite database (added some new records) - saved it, reimported it into my Xcode project, and re-ran my app - all the new data showed up perfectly well on the iPhone Simulator as expected.
However, after installing the app on my iPhone, I'm still getting the old data that was bundled with the previous version of the app.
I of course deleted the older version of the app from the iPhone first, assuming it would thereby destroy its "Documents" folder and the older db file that was in it - but for some reason its still reading (or displaying) the old data - which doesn't make sense. Any ideas?
Try rebooting your device after you make database changes, and then seeing what sort of results you get.

Monotouch and sqlite database

Here's the scenario: I have created a db3 file, attached it to to the solution, changed it to content (tried resource as well), and copying all the time. When I launch the app, I copy this to the document folder of the app. Now, it works flawlessly in the simulator, i.e. I can both read and write. But on the device, it's only in Read-Only mode. How do I make it writable on the device? I am using the latest ios 5 and latest monotouch.
Thanks in advance for any help.
And Merry Christmas everyone :)
Files stored in the .app directory are read-only on device.
If you need to have a read-write version of any of your data files, you need to copy this to your Documents storage area.

Updating Sqlite DB on iPhone Applliction

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.

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/

SQLITE no such table: error IPhone

Im have been using sqlite as a store in my app and everything was going fine problem is i changed my database schema deleted the old one and then inserted the new one in and now the application no longer loads any data despite all of the sql statements working fine whenever i run them in the firefox plugin. I have done a build clean and reset the simulator as well as delete the app in the simulator does anyone have any ideas whats going on?
-Have you copied the new database to the documents directory in the appdelegate?
-After deleting the app from the simulator, and do a clean all, it should copy the database to the app's documents directory. Or if you won't change the database, you can delete the old and copy the new one every start.