I'm looking at replacing ALAssetsLibrary
with Photos
framework in my app.
I can retrieve photos, collections, and asset sources just fine (even write them back out), but don't see anywhere to access the metadata of the photos (the dictionaries such as {Exif}, {TIFF}, {GPS}, etc...).
ALAssetsLibrary
has a way. UIImagePickerController
has a way. Photos
must have a way too.
I see that PHAsset
has a location
property which will do for the GPS dictionary, but I'm looking to access all of the metadata which include faces, orientation, exposure, ISO, and tons more.
Currently apple is at beta 2. Perhaps there are more APIs to come ?
UPDATE
There is no official way to do this using only Photos APIs.
However you can read the metadata after you download the image data. There are a couple of methods to do this using either PHImageManager
or PHContentEditingInput
.
The PHContentEditingInput
method required less code and doesn't require you to import ImageIO
. I've wrapped it up in a PHAsset category.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…