Upgrade an app with new data in core data - ios

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.

Related

How to check previous version app already installed in iOS Device?

it assumes very simple question but its typical problem for me .
I have a live paid iOS app in App Store . I want to update it in my phone with new Sqlite .
I want test some scenario for that I want installed update from my Xcode in free.
How can i update app installed from App store by Xcode as i have new code of that app.
in my live app there in no USERDEFAULTS to store current version.i can code in new app.
How to delete previously used sqlite and installed new app free if already buy that app.
Thanx for reading.
guide me if any understand it and any idea about it.
Thank in advacnce
http://blog.digidna.net/post/74246563623/how-to-release-a-whole-new-app-and-keep-all-things this was i want
SQLite database file is just a normal file, you do not need any special steps to update it.
Get the file path or URL to the SQLite file , and use
NSFileManager's method removeItemAtPath:error: or removeItemAtURL:error:
Then create the new database the same way you created the old one.
Also check this link if get any problem.
EDIT :
You can delete your old SQlite database file if it's copied in document directory. You CAN NOT delete files from bundle.

Sqlite database and app upgrade process doubts

We have stored our app sqlite database in the Library folder. We need that for future app upgrades from app store, the database included in the upgraded app to delete the database from the installed one when users download it from app store. We have checked from different sources, and they say that only the content in Documents folder will not be deleted.
Please can you confirm this point?
Thanks
The Library folder will survive an app upgrade. It's possible that Library/Caches will be deleted but not Library in general.
The simplest solution is to have the new version of your app use a different filename for the database file and have code that looks for and deletes the old database file.

Backup and Restore sqlite db during new version release

I am working on an iPAD application. When a new version is released, I add the version number on the server side db and call it through a webservice and check with the build version of the app. If there is change in the version I am calling a URL to install the new version of the app. What will be the possible solution, not to lose my data from the iPAD app and once the new app is installed I use back the same sqlite db. FYI... I am not using any MDM, and installing the app through an URL. Let me know if I need to explain more in detail.
In the past, app version update usually reset the data to the bundle as packaged in the archive (ipa). The user data in the databases then become lost. (Note: this may have changed in IOS 7 because of the announced incremental update options but I have never been able to check it out).
My way around this is to provide a backup restore facility that creates a Plist in the /Document Folder. this allows the user to extract his data through iTunes File sharing, then restore it back if he or she wishes. If you have a server though, a better way would be to create folders for registered users and program the facility to back / restore from the server. Prompt the user to use the backup prior to any update, and prompt the user to restore data from the server (if available and the database is empty).

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.

Publish update-only distribution to Apple App Store

If I have an app that preloads a database when it first launches, is there a way to then in future publish an update only version for the app?
(IE excluding the preloaded db file so the update isn't bigger than necessary as an existing user wont ever overwrite their preloaded db - but at the same time being able to publish one WITH the preloaded db so that new downloaders will get a newer version of the db)
If there's an alternative way to approach it please let me know. Just to clarify, the app automatically updates the db with data when used - that's why I have no need to include the preload for every app distribution for users who have already downloaded.
I've looked on Google and can't find an answer - but maybe I'm just not using the right terms!
When you create an update to your application, your app will need to check if the user already have a database in the Document folder. If one doesn't exists, your updated app will copy the default database from the Application Bundle.
Also, if you add features to the app, new table or columns to your existing database schema it would be nice to use Core Data Model Versioning and Data Migration.
Excerpt from Apple Docs - Reducing Download Size for iOS App Updates:
Starting with iOS 6, the app store will automatically produce an update package for all new versions of apps submitted to the store.

Resources