0

Say I have an app which allows user to pick some images from assets library.

When running for the 1st time, user picks some photo, at the 2nd run, when user wants to pick photos, I'd like to set the photos user picked last time as already selected.

How do I identify photos between multiple runs of my app?

CarmeloS
  • 7,868
  • 8
  • 56
  • 103
  • Please see Joanne's answer here: http://stackoverflow.com/questions/4314405/how-can-i-get-the-name-of-image-picked-through-photo-library-in-iphone – drew.. Feb 15 '15 at 16:30

1 Answers1

0
  1. iOS apps usually don't get terminated, but get sent to background - state will be unchanged when getting back to foreground
  2. For case your app get's terminated anyway, you can store data in NSUserDefaults, CoreData, the file system or the keychain. In your case it sounds like NSUserDefaults would be a good choice. Don't forget to restore last states on app start.
dogsgod
  • 6,267
  • 6
  • 25
  • 53
  • You can *never* assume an app's previous state, and making such assumptions, and basing coding on such things, will lead to disaster. A good philosophy: if something can happen 1% of the time, code for it happening 100% of the time. I think the OP is asking if each asset has an already-available unique ID we can tap into to, that will allow us to track such things. – drew.. Feb 15 '15 at 16:30
  • Not assuming anything, just covering cases. – dogsgod Feb 15 '15 at 17:20