SQLITE no such table: error IPhone - 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.

Related

Core Data Appears to Lose Data After Xcode Upgrade

For the second time, my core data app has "lost" (explanation below) the data. I'm not positive this has to do with the update of Xcode, but I did update to 9.4 today (I don't remember whether there was an update involved the last time this happened). I entered data yesterday, then closed the app, re-opened the app, and everything was fine; all the data was there. Today when I opened the app, there was no data. My app prints out the location of the database (print(container.persistentStoreDescriptions)), and when I look at the sqlite file there it has 25 kB.
Searching through the ridiculously deep folder path, I found a file that said it was modified yesterday, and when I look at the sqlite file there (with DB Browser for SQLite), the data is all there (also 25 kB). It seems as if Xcode has forgotten where it put the data. Has anyone else experienced this?
How would I go about fixing this? I guess I could copy the SQLite database from where it actually is to the place Xcode thinks it is (the other files there also, .sqlite-shm and .sqlite-wal?).
after the update of Xcode, the device that initially ran was iPhone 8, whereas, I had been running it on an iPad simulator before the update
Each simulator gets its own folder with its own sqlite files. So if you want to see the data that was in the iPad simulator before, you need to run the same iPad simulator from the new Xcode. If you copy sqlite files from one simulator folder to another, be sure to copy the -shm and -wal files too.

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.

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.

Contents of SQLite dbase on iPhone are deleted after crash

I have this weird problem where I lose my data after a crash.
What happens is the following:
I insert a product in the app -> product is saved to the sqlite database.
The app crashes. At this moment the product is still in the database (I double checked this on simulator and iphone device with ftp to get my sqlite database off my phone.)
At the moment of reinitiating my app, the contents of the sqlite are removed. And an empty sqlite with the same tables etc is replaced.
I wonder why and how to fix this problem.
Thanks in advance,
Lewion.
I presume on start-up you're checking for the presence of the database in your document directory and copying a "clean" copy from your bundle if none is present.
Are you sure the problem doesn't lie in the logic you're using there?

Sqlite database is not updating

Hi am new in this field.i am trying out one app.
i am storing data in sqlite database. i am only using sqlite for my app when i add data into table from my app, I can see changes in my simulator but when i check my database there is no change and when i reset my simulator all my added data is gone. Please help me. i don't know what is wrong. there is no error.
When you say "reset my simulator" does that mean quit the app and restart it, or use the "Reset Content and Settings" option from the iPhone Simulator menu?
Doing the latter will erase all simulator apps' data, but doing the former should not.
How and where are you creating the database file that you intend to write to?
The correct thing to do is generally the following:
Put an empty copy of the database (probably with necessary tables created and any initial data already entered) in your app's bundle.
On app launch, check for the existence of the database file in your app's Documents directory. If it doesn't exist, copy it from the bundle to Documents. If it does exist, do nothing.
Your app should write to the copy of the database in your app's Documents directory. This means that the database in your app's bundle will (and must) stay the same, but the one in Documents will contain any new data.