3

I am picking image using UIImagePickerController but I also need image’s name and other metadata information. I could have fetched image asset using ALAsssetsLibrary’s assetForURL:resultBlock:failure method with the help of referenceURL provided by UIImagePickerController after picking image but that method/Framework is deprecated in iOS9. I searched for its equivalent method in Photos Framework but I didn’t find one.

Let me know its equivalent method or any other way to fetch selected image’s metadata using Photos Framework.

Bhushan B
  • 2,470
  • 4
  • 26
  • 38

1 Answers1

0

Yes you can read metada with Photos Framework like that;

asset.requestContentEditingInputWithOptions(options) { (fooContentEditingInput: PHContentEditingInput!, _) -> Void in
    //Get full image
    let imageUrl = fooContentEditingInput.fullSizeImageURL
    let orientation = fooContentEditingInput.fullSizeImageOrientation
    var finalImage = CIImage(contentsOfURL: imageUrl)
    finalImage = inputImage.imageByApplyingOrientation(orientation)

    for (key, value) in finalImage.properties() {
        println("key: \(key)")
        println("value: \(value)")
    }
}
Kemal Can Kaynak
  • 1,638
  • 14
  • 26