PhotosKit should have a method for fetching assets with a given UTI
| Originator: | jelly | ||
| Number: | rdar://21993724 | Date Originated: | 25-Jul-2015 12:01 PM |
| Status: | Open | Resolved: | |
| Product: | iOS 9 | Product Version: | Beta 4 |
| Classification: | Enhancement | Reproducible: | N/A |
Summary: PhotosKit could greatly benefit from methods to allow fetching PHAsset objects by their universal type identifier (UTI), i.e. +[PHAsset fetchAssetsWithUTI:options:], or at the very least, a UTI value on the object itself so that it can be tested without first downloading the actual image data. Previously, with AssetsLibrary, one could iterate through the photos on device and use the UTI property in the ALAsset's defaultRepresentation to filter for the assets that match the given identifier. Obviously, I would like to properly migrate to using PhotosKit, but my usage of the SDK is to use the UTI to filter assets to just the UTIs that I support (predominately GIFs), and to filter out actual photos in the user's library. At present this is not possible without first downloading the image data, which is terrible for users who have large libraries in iCloud Photo Library. Steps to Reproduce: Attempt to use PhotosKit to fetch only images with the 'com.compuserve.gif' UTI. Expected Results: A static method on PHAsset allows fetching images with a given UTI, or potentially a array of valid UTIs. These can be confirmed and further filtered using a UTI property on the PHAsset objects that are returned, all without needing to first download the image data. Actual Results: Fetch a selection of PHAssets with the closest media type approximation (i.e. Images), then use [PHManager requestImageDataForAsset:options:resultHandler:] to fetch the image data for each image, and keep or discard based on the dataUTI provided in the resultHandler block. Note that while this method technically works, it means downloading the image data, which is less than ideal.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!