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.
Related
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.
I have a PhoneGap based iOS app which uses SQLite DB for offline storage. The app is not working after an app update in iOS 5.1. The same app is working fine in versions below 5.1.
I explored few things and my analysis is
When we install a app iOS creates a separate sandbox for that and all the data related to that app goes in to that.
in iOS5.1 when we update an app new sandbox is created and the contents from old sandbox is moved here.
For WebSQL i.e SQLite for PhoneGap in iOS 5.1 the DB is stored under caches folder(volatile storage). But in previous version of iOS the SQLite DB was stored under Documents folder in Sandbox which is persistent storage.
The real problem is there is a file called ".preferences" in caches/preferences that has the path of websql DB. when i do an app update the sandbox path changes but in this file the previous sandbox is path is still available due to this the app is not working as the previous path is already deleted from device.
Is this an Apple issue or can it be resolved by a developer?
I have fixed the issue by
The path referred by iOS to find WEB DB(SQLite) and Local storage is stored in NSUserDefaults.
So when i launch the app every time i check the path information and make sure it matches new sandbox path if not i set the value for that Key and now the app works fine.
NSUserDefault Key referred to SQLite path is WebDatabaseDirectory.
If Apple releases a fix for this issue in their next release, this code is not required.
Try to use cordova-1.6.0 or above this.
When I changed to cordova-1.6.0 , my problem is fixed.
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 want to save a file outside of my application bundle as a backup of database so that when user reinstall my app or my app crashes he can backup his data from that location.
Apple already does this, with iTunes.
What you are asking is technically against apple's policy, unless you store it off site, on a server (which you could easily do)
If you have a lot of applications, I'm not aware of the policy, but perhaps you could make an app to back up your other app's data.
I need to change the bundle identifier of my iPhone app before I can upload it to the app store. However, I also have data in my Core Data store which want to continue using even after I change the bundle identifier. However, it seems that the bundle identifier is how the iPhone knows whether apps are identical with one another, so I end up with two distinct copies of the app -- with two distinct core data stores -- on my phone! I know that I can download the sqlite data store through the Xcode organizer, how can I make sure that my data transfers to the new app package with the new bundle identifier?
With some exceptions for OS4 every app (identified by it's BI) has it's own isolated storage on the phone.
If you really have to change this (will also disable free updates for buyers of the "old version") you have to find an external migration way.
A lot of apps offer some kind of "backup" (on a PC / MAC or something else).
What we did for a customer was to establish a website which allows "short time data storage".
So that the old app could upload the data - and the new one loads it down.
Of course this means updating your old app first for the "export".
But the idea "your app lives in it's own isolated world" also means that you have no access to the data of other apps.
From the point of security this is imporant and good.
For building "app suites" where the apps want to share data it's bad.
But apples made enhancments for this in OS4 - which (I guess) won't help you in your case, since "sharing apps" must also be special designed.
I know this question is very old, but I just noticed it while looking for the answer to the same problem and thought it still might be useful for others. The original poster half-answered his own question, but didn't quite take the next step.
If you have not yet released your app on the app store and you want to change your bundle identifier, it is possible to copy your CoreData store from one sandbox to another using the Xcode organizer as suggested above. Obviously, this is only useful for your own device (which I think is what the original poster wanted to do); this process won't allow data to be transferred on other users' devices if they've bought your app, so DON'T change your bundle identifier after your app has been released.
First, run the old app (the one with the old bundle identifier) on your device. In the Xcode organizer, select your device, then Applications, then select the app (with the old identifier) and download the data to your mac.
Then install the new app on your device (build and run it, then quit). In the Xcode organizer (and on the device itself) you should now be able to see two apps, one with each bundle identifier. Select the one with the new identifier, select upload and upload the data file you saved from the old sandbox. You should now have access to all your old data in the new app. Very handy if you don't want to recreate all the data.