PHImageResultIsDegradedKey/PHImageFileURLKey is not found

前端 未结 9 903
忘了有多久
忘了有多久 2020-12-09 22:59

iOS 13 beta4 no longer gives

1) PHImageFileURLKey 2) PHImageResultIsDegradedKey in image result info keys.

Anyone knows a way to find the fileurl of the P

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 23:29

    In iOS 13.0, PHImageFileURLKey is removed. In order to access PHAsset data, When we call this function to requestImageData we can get image information through this key PHImageFileUTIKey.

    PHImageManager.default().requestImageData(for: asset, options: PHImageRequestOptions(), resultHandler:{ [weak self] (imagedata, dataUTI, orientation, info) in
    
    if let assetInfo = info, let fileURLKey = assetInfo["PHImageFileUTIKey"] as? NSString {
    let fileComp = fileURLKey.components(separatedBy: ".")
    
    if fileComp.count > 0 {
       // Do your stuff.
    }
    
    })
    

提交回复
热议问题