I am starting to use NSItemProvider methods hasRepresentationConforming and loadFileRepresentation for importing images, live photos and videos from PHPicker on iOS.
I would like to generate thumbnails / preview images for each imported image, live photo and video. I tried using theNSItemProvider method loadPreviewImage, but in testing with Xcode Version 12.0 (12A7209) in iOS 14 Simulator, the NSItemProvider.CompletionHandler always returns nil for the item regardless of whether I use NSData, NSURL or UIImage.
Is it best to generate thumbnails by scaling down imported images with UIGraphicsBeginImageContext and use AVAssetImageGenerator on imported videos?
I would like to generate thumbnails / preview images for each imported image, live photo and video. I tried using theNSItemProvider method loadPreviewImage, but in testing with Xcode Version 12.0 (12A7209) in iOS 14 Simulator, the NSItemProvider.CompletionHandler always returns nil for the item regardless of whether I use NSData, NSURL or UIImage.
Is it best to generate thumbnails by scaling down imported images with UIGraphicsBeginImageContext and use AVAssetImageGenerator on imported videos?
Update: For now, I have decided to go with using QLThumbnailGenerator to create thumbnails for resources imported from PHPicker. In the future, this generator should be very easy to swap out for NSItemProvider method loadPreviewImage if that starts working on PHPicker.