awkward / Tatsi

A drop-in replacement for UIImagePickerController with the ability to select multiple images and/or videos
MIT License
110 stars 30 forks source link

selected images #22

Closed dathu7728 closed 4 years ago

dathu7728 commented 5 years ago

This image getting URL:

Assets [<PHAsset: 0x11dc12570> 2E25AD2C-51D8-4431-882F-AC8CA2E8F65B/L0/001 mediaType=1/0, sourceType=1, (3024x4032), creationDate=2019-04-08 10:04:57 +0000, location=0, hidden=0, favorite=0 ]

This image not getting URL: (app will crash for data nil)

Assets [<PHAsset: 0x11dc065f0> 420A3B33-A758-4EC3-9DC1-D72AC88B98C9/L0/001 mediaType=1/4, sourceType=1, (1242x2208), creationDate=2019-04-11 07:14:37 +0000, location=0, hidden=0, favorite=0 ]

what are the difference b/w the above two Assets, How to resolve this issue ?

renssies commented 5 years ago

I'm not sure how you are getting the images from a PHAsset, but officially the only way to get the underlying data of PHAsset is through the PHImageManager (recommended) or PHAssetResourceManager.

Using PHAsset or PHAssetResource directly might cause no data to be returned or simply outright crash the app. This is mostly related to iCloud photos and optimized storage, where it could mean that the data isn't actually (accessible) on the phone yet. PHImageManager and PHAssetResourceManager make sure the data is accessible locally before returning.