We are storing a unique identifier for the mobile device in an SQLite database, to be used for licencing purposes. The problem is that if a user removes the application then reinstalls it again, the SQLite database is gone along with our stored variable.
How to prevent removing the databse upon application installation, so that we can reuse the database if the application was reinstalled again
Thanks
You can approach this by sending the information to a server side, you can't store any data out side the application sandbox.
You could:
Store the key on your own server
Store the key in the device's keychain. Notice that you won't be able to remove the key from the user's keychain after the app has been removed from their device. More info about the keychain here: https://developer.apple.com/library/ios/#documentation/Security/Reference/keychainservices/Reference/reference.html
In the program you can create a copy of the SQLite database. Simply drag and release the database into the program resources.
Related
I have written an app the uses the RealmDB, which produces a file called default.realm. This is the database storage file. I would like to setup my app to make use of the iCloud automatic backup feature. How can I setup my app to do this?
You can't! Because your app is already set up like that! :)
According to the File System Basics page on Apple's website, all files in an app's Documents folder will automatically be backed up to iCloud, or the user's local iTunes account if they've chosen such. This is on by default, and must be explicitly disabled through code if disabling backup is desired.
By default, Realm places default.realm in the Documents directory for this exact reason: to ensure any user-generated data stored in it will be properly backed up in through iCloud and/or iTunes sync operations.
So you don't need to worry! Your Realm data is already being properly backed up by iCloud as we speak! :)
In my app I'm using NSUserDefaults to store user data, when upgrading to a new version from App Store will those values be saved or deleted/ rebooted?
(for example: [prefs setInteger:_numberOfTimesAppOpened forKey:#"openApp"]; if before the upgrade the value is 70 after the upgrade will the value be 70/ 0/ or non existent?)
in case these parameters are deleted what is the right approach to save user data so it will be saved even when upgrading the application?
another question is if there is a way to store information on the device so if the user delete the app and then re-install it his previous data/ profile can be set?
Everything that is stored in UserDefaults will be still there after an update. They are persisting. User defaults will get deleted when the app is removed from the device by the user.
And there is no way to store if an app was installed already once. At least not on the device.
I want to store a date string in the iphone device, but not in the application context, because if a user deletes the app then that value is deleted too.
Is this possible?
Store it in the keychain. Keychain data is not deleted when the app is.
A possible solution is to store all the information on a server. You could use rails, php, or any other server framework to do this. Also, there's a new service that's trying to make it so you don't have to do any server coding at all: http://www.parse.com
If the application gets deleted on iPhone, all its related files are also deleted. Including files, SQLite databases and preferences.
If you want preference to persist after deletion, you will need a server and allow the user to store that information there (in the cloud).
i am new in programming and have some troubles with backup.
I have an App with SQLite database and different user params in it. All data will be saved, after I leave application. But if I reinstall it, all data is lost.
So, i think i need some kind of backup for this data. I mean is there any way, how to save SQLite db outside of apps folder?
Updating the application will not overwrite your data, but deleting the app will remove all data. You don't need to delete the application each time you redeploy to your device or simulator.
Your application doesn't have access to anything outside of it's sandbox, so saving outside the apps folder is out of the question.
Does anyone know of a non-programatic method of removing data stored in the keychain when the application is deleted from the device?
I've read on several threads on SO that the data will persist even if the application is uninstalled and my experience confirms this is true.
However this seems contrary to what is specified in Apple's iOS Application Programing Guide: "The keychain data for an application is stored outside of the application sandbox. If an application is uninstalled, that data is automatically removed".
You could wipe the iPhone by using Erase all Contents and Settings.