views:

39

answers:

1

If I allows users to select photos and need to store those selections (in a database), can I store a link to the selected photo or do I need to grab the image and store it in the app's Documents folder? The latter doesn't seem practical since it will cause the image to neednessly take up double the amount of space.

I'm familiar with UIImagePickerControllerDelegate but not sure how to obtain a reliable reference to an image that sustains across application restarts. There is probably the concern that the link can break if the user deletes that image from their photo library. Is there a way to check that?

+1  A: 

There is no way to get a file url to an image stored in the Photo Library.

If you really do need to keep a reference to the file for programatic reasons, then choosing the image from UIImagePickerController and saving a copy to the Documents folder is probably your only option.

It would help if we could understand why you require a file reference to the image. As far as the iPhone is concerned, the image is safe and sound in the photo library, if user needs it, it can be picked from the image picker, like normal.

However, if you're trying to use it for a customisable background or something, then I think saving a copy is your only option.

Jasarien
Thanks. I need to keep a copy of the chosen image because the user will select images, which will be used in the app. The user will then arrange images based on some criteria. The app will always work off of the images chosen by the user. To avoid having the user choose images after each app restart, I need a reference, which really sounds like storing the image in the Documents folder. Does that seem like the way to go in my case?