2015-11-05 32 views
2

我正在使用UIImagePickerController采摘图像,但我也需要图像的名称和其他元数据信息。在采集图像后,我可以使用ALAsssetsLibrary’sassetForURL:resultBlock:failure方法获取图像资源,并且在012UR提供的referenceURL的帮助下获取图像资源,但该方法/框架在iOS9中不推荐使用。我在Photos Framework中搜索了它的等价方法,但我没有找到它。什么是在Photos Framework中ALAsssetsLibrary的assetForURL:resultBlock:失败的等价方法?

让我知道它的等效方法或任何其他方式来使用Photos Framework获取所选图像的元数据。

+1

使用'+(PHFetchResult *)fetchAssetsWithALAssetURLs:(NSArray的 *)assetURLs选项:(null的PHFetchOptions *)FROM'Photos.framework' – VRAwesome

+0

@CuteAngel感谢,它的工作options' ... – Bhushan

回答

0

是的,你可以用照片框架阅读metada;

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)") 
    } 
} 
相关问题