How to update the sqlite database in iOS using iPad? - ios

I want to do is to update the sqlite database in iOS using iPad. It is possible to drag the sqlite file in iTunes? Just to check if the data from sqlite display correct. I used DB Browser for SQLite.
Thank you in advance.

Related

How to migrate an existing Appcelerator Titanium app database to a native Swift iOS app

I'm about to rebuild an application originally written in Appcelerator's Titanium into a fully native iOS app written in Swift.
The app relies heavily on the SQLite database created using Titanium Alloy Models, whereby users save items into their local database on their phone. I need this data to be accessible when the user updates their app with the newly rebuilt version.
Here are my questions:
Will the database be carried over when the app gets updated?
Can I access the database with the new Swift app?
Can I still create models in the new swift app for the database items?
If I create models in Swift, will they override the tables I created in Titanium? Will the user's data get lost?
Are there a set of best practices for this?
Please note I need to achieve this in Swift - not Objective C
Note, what I'm doing is basically the reverse of this question:
Titanium - Retrieving SQLite Data from previous version of iOS App
Unless you tell it otherwise, Alloy will generate a _alloy_ database at the location documented under Ti.Database.open().
Unless you specify an idAttribute in your model adapter config, Alloy will create an alloy_id UNIQUE TEXT column to store the unique guid for each model.
Apart from that, it's a plain old SQLite database that you can access from Swift.

When to use SQlite — iOS

I just learned the basics of integrating SQLite3 into an iPhone app, but I still don't really know where or when to use it. Is the SQLite database just locally created on the device or will every app have its own database? If I for example want an app where the user can upload a recipe to the database, will other devices be able to fetch that recipe from the database or do I need something else to make that such of app? Sorry for the noob question but I can't find an answer..
An SQLite database, in iOS, is stored locally. That means that every iOS device has his own independent SQLite database.
Usually, in the case of the recipe you mencioned, you need a backend to sync information with other devices. You can update your SQLite database or just browse the information without a SQLite database behind.
Aditionally, in iOS you have one tool under your belt that it can be used to persist information locally : Core Data. There are some tools that can be used to sync core data information with a server like Parse.
Your app will have its own sqlite database. Your app can have 100 sqlite databases if it wants. It's just a file like any other file your app works with. It will be specific to your app in your app's sandbox. It will not be shared across devices. Just like any other file.
A SQLite database is just a file that you would put in your app's directory, and iOS apps are sandboxed so that one app can't read the files of another app.
If you need to share data from your app, you can have your app implement a URL prefix, and you read the data in your app, but share it using the system defined mechanism. Have a look here, here, and here for more guidance on the subject.

coredata values not contain in my ipa file ios

I had used core-data successfully in my project. But when I build the ipa to test on device, it contains no values stored in core-data. can anyone help me in this context? Thank you in advance
Whatever objects you had created/saved was stored in the local store in your mac when testing using simulator. So when you start testing on the device the local store gets created from scratch. You need to write code to pre-populate your store.
Another way is to move the sqlite file from simulator to device. Check out
Core data migration from simulator to device for more information.

view sqlite files on ipad

I developed an app which uses core data and creates an sqlite database on the ipad.
For debugging reasons I would like to access the sqlite file on the ipad.
I know the "fileURLwithPath" on the ipad but do not know how to get there.
On the simulator it is easy, since I can access any sqlite file on the mac with firefox sqlite extension.
But how can I access the ipad files?
Try using this to copy it to your mac first:
http://www.macroplant.com/iexplorer/

Upgrade an app with new data in core data

I have a problem in upgrading my app live in App Store.
This app has a core data database with 100 records. In my new version, I want to upload a new database with the same schema, but with 101 records and I want that when the user updates the app, the new data are displayed.
From my understanding, if I simply update data in core data, the old database is maintained and the only way to access to the new data is to unistall the app and install it again.
Do you have any suggestions to force the installed app on the phone to use the new core data after the upgrade?
Does the app have a sqlite file part of the bundle? If so you can just check how many rows are in core data. If 100, then copy the new sqlite file from the bundle to the Documents directory. This link might help.

Resources