0

I want to keep some of the critical(and less memory consuming) data of my App(ex: licence key or user credentials), stored in the device. In normal scenario, when the user deletes the App from the device, all the data related to the particular App gets deleted.

But I would like to override this behavior, and store some important stuff inside the device's disk, so that it does not get deleted along with the App. How to do that? Any help is much appreciated.

Selvin
  • 12,333
  • 17
  • 59
  • 80
  • 1
    That would be a performance/storage loss and potentially a security risk, and would make "deleting" an app (especially to save space) meaningless. Why on earth do you want to do this? – jtbandes Mar 15 '12 at 12:00
  • My application is a survey application. So the user would to take many text surveys which has to be stored and kept in the device, until user can sync the survey data back to the server. In between whatever happens(including app crash, app deletion) the data has to be persisted. Is there any way to do that? – Selvin Mar 15 '12 at 12:05
  • 2
    No, you should probably consider having user accounts synced with an online server. This will also let people keep track of which surveys they've filled out across multiple devices. – jtbandes Mar 15 '12 at 12:06
  • @jtbandes what do you think of my answer..? Can it be done this way..? – Ankit Srivastava Mar 15 '12 at 12:19
  • Perhaps, but that's not what the keychain is meant for, and I think @selvin should still seriously consider if this is necessary. – jtbandes Mar 15 '12 at 12:21

2 Answers2

2

Hopefully for obvious reasons that isn't possible. (What if every app did that? They you'd delete every app on your device and still find that gigabytes of space were being taken up by "deleted" apps.)

No, if you want data to be saved even after deletion, you'd need to store it in "the cloud" somewhere.

Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
2

you can always store the license key and user credentials in the ios keychain.. it will stay there even if you delete the app. You can use the SSKeyChain API to access the key chain. Keep in mind you can only trivial string info this way.

Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115