使用UIImageJPEGRepresentation
转换数据并查找字节数将无效,因为压缩值未知。有没有其他方法可以做到这一点?
答案 0 :(得分:0)
let assetPath = info[UIImagePickerControllerReferenceURL] as! NSURL
let asset = PHAsset.fetchAssets(withALAssetURLs: [assetPath as URL], options: nil).lastObject
PHImageManager().requestImageData(for: asset!, options: nil) { (data, value, orientation, info) in
// data?.count will give total bytes
print(data?.count)
}