I am retrieving an image from the user’s photo library, and saving that image in the documents directory. I am currently naming the picture based on what the user enters in a text field. This works, but the text field is not really a good name for the picture. I would like to use some sort of unique identifier for naming the pictures.
Any ideas or suggestions? I just do not want to have conflicts when a large amount of photos are saved by the user.
One method is to use UUIDs. Here is an example:
Or an ARC version:
Even easier iOS6+ solution:
More info here: http://blog.ablepear.com/2010/09/creating-guid-or-uuid-in-objective-c.html and here: http://en.wikipedia.org/wiki/Universally_unique_identifier