Getting to know if my app is updated from app store - ios

I am going to publish a new version of my app on app store. I just want to know that if the app is being updated from the previous version or user has installed a fresh copy of the new version of my app. Based on this information i want to show some information to the updated users.
I was thinking of to keep a key in my NSUserDefaults of the previous_version but i haven't added any such key in the NSUserDefaults of my previous app version. So this key will be nil in both cases in my new version.
Is there a way i can get to know if the user has updated the app or installed a fresh copy of my app.

There is no direct way for it. Indirectly you can check it. If you are moving your editable data into Documents directory in your previous version then at the time of launching new application, you can check if the file is present in document directory. If you can find it, the application is opened after update and if file is not present then it has been opened because of a fresh installation.

Related

When Apple app association file downloaded to iOS device

We have deployed the app-association file to production server. Now I would like to add a new path to app-association file. So my question is whether new app-association file will get dowloaded to user device when new app is installed or app update?
OR will it get updated in user device immediately when app-association file is updated in server?
Appreciate your help
The apple-app-site-association file is pulled when the app is first downloaded, and whenever an update is downloaded from the App Store. So basically you'll need to release a new version of the app before all your existing users see the new 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.

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).

How to save data from version to version in iphone app development?

I'm having a problem for my app, a Chinese-English dictionary. I'm now adding a wordbook for it, and try to save the contents of it to a plist every time users exit the app. But now I find that as my app updates, all these data will get lost because the path of the app is changed.
I'm now working for a company so the app will keep releasing new versions, and how can I save the data from version to version?
all these data will get lost because the path of the app is changed.
That would indicate you're writing to your application's directory structure. Don't do that.
The iPhone has a documents directory.
Document Directory discussion

Resources