0

I have an iOS application that I am working where I am capturing an image, and then storing it in my Photos Album. I realize that I am able to write custom metadata for this image when I store it using the following:

writeImageDataToSavedPhotosAlbum:metadata:completionBlock:

My question is, is it possible for me to somehow retrieve this same image later on, using this metadata as my search criteria (if for example I store this same metadata in CoreData, and use it later in a query)? An example of possible metadata I am planning on using is either a date and time stamp, and/or geolocation. Is retrieval of images possible using metadata and not knowing the exact file name?

1 Answer 1

0

If you already have a Core Data store, save all of the metadata and the asset URL (for the default representation). Then you can do all of your querying locally and access the assets only when required (though you should check they haven't been deleted before showing results).

When you have done your search to get the asset URL you can get the image using assetForURL:resultBlock:failureBlock: from the ALAssetsLibrary.

4
  • Thanks very much for your prompt reply. This is exactly what I am hoping to achieve. Can you show me an example on how to do a local query of the images using the metadata?
    – syedfa
    Aug 26, 2013 at 16:23
  • The query is in core data, not against the asset library.
    – Wain
    Aug 26, 2013 at 16:24
  • Also, I think you are limited to only defined keys in the metadata (though I'm not 100% sure if that is still the case).
    – Wain
    Aug 26, 2013 at 16:25
  • I guess my question is, how do I display a particular image when all I have is just the metadata? This is not the same as having the exact URL which is a direct reference to one specific image.
    – syedfa
    Aug 26, 2013 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.