Sqlite database and app upgrade process doubts - ios

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.

Related

Updating iPhone app removed the older version data

I am developing a social application for iOS using Objective-c. But when I published the newer version of my app and upgraded it using App Store, all of my older application data has been removed while every thing in both versions is the same like Bundle Identifier, Provisioning Profile, Signing Certificate. But I am confused why some thing like that happened. I was wondering if anyone could help me. This is too important for me, because this problem forces users to register again in the application.
update: I save data in the documents and also using core data
It might not be cleared just the path of the files changed, for example lets say you save the path of a photo like this :
/data/Containers/Data/Application/B42FE84A-E031-4A2C-AEA7-8D77AEAA389C/Documents/Photo.jpg
when you update the app the path will look like this because iOS will change app documents folder
/data/Containers/Data/Application/757455E1-355B-4040-8ABB-85F39D650A1E/Documents/Photo.jpg
so the file still exist but the path have changed and since you are saving the path the app won't find it because it was changed
i recommend saving only file name not the whole path

Fetching previous saved database file after reinstalling the app

I am new to ios development so please pardon if I am asking a silly question.
I need to check if my sql file from the previous installation of the same app exists in the device directory already. If yes, then I need to fetch that file instead of making the new one. But the bundle folder of the app changes after reinstalling the app. So I cant guess the name of the previously installed app bundle folder. I tried to save it elsewhere on the device, but it isn't allowing me. Please suggest me the solution.
What you're asking for isn't possible. If an app is removed, all its files are deleted as well. In iOS, there is no app-neutral place to store files. When an app is merely updated, the update happens "in place" from the perspective of the app, and all previous files are available.
If you want files to survive a delete-reinstall cycle, you'll have to use a cloud service, such as iCloud, Dropbox or Google Drive.
once app is deleted. Application bundle and document directory and all files (including SQLite file)are deleted. u have to fetch all data from API.
In iOS each application is a Sandbox. This Sandbox consists of Application bundle and Mutable part where you store your database and other files which are mutated during the life span of an application.
When you delete the application, entire Sandbox is removed. The only thing which does not get remove is the data which you have stored in keychain.
When you update the application, only application bundle gets updated and Mutable part remain un-touched. So while re-installing the application when it is already present (technically updating the existing application on the device), you can find the same file from the same location.
You can do one thing you can take daily backup of that file on remote server and when you reinstall app check that file exist on server if exists than download else create new.

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.

retain program data in iOS app while updating and sync to iCloud

When a new upgrade is released and installed on iOS, which folders / files are left untouched by the upgrade process? There are several folders; Library, Caches, Preferences, Documents.
Normally Application Support Directory is not created by default. What happen to AS folder during upgrade?
I learn that all data in Documents folder will copy to iTunes or iCloud by default. Is that true?
If I create my own CoreData db to persist, where should I keep?
Your best bet is to read the first half (which pertained to iOS) of this document from Apple:
In my experience, I put Core Data db in Documents folder if the iTunes File Sharing feature was not enabled on your app. Otherwise create a folder in the Library folder called Application Support or anything name, etc. With iTunes File Sharing enabled, user can accidentally delete any files in the Documents folder.
During the upgrade, the contents of Library and Documents folder are retained.

Preventing erasure of user data while upgrading iOS application via iTunes

I want to upload a new beta version of my iOS application for beta testers group. Users save their data in the Documents folder. What do I need to do in order for users to upgrade their application without losing their data?
The Documents directory is not overwritten when you update an app so as long as your data is compatible between versions, you shouldn't have to do anything special.
Alternatively, for developers, Xcode's Organizer allows you to extract the contents of an apps Documents directory easily.
Downgrading iTunes to 7.7 seems solved the problem on Windows

Resources