[iOS] Photo thumbs are missing when Pick concrete photos permissions has been chosen and using multiple photo selection
IngweLand opened this issue · 5 comments
Bug Information
Version Number of Plugin: 5.0.1
Device Tested On: iPhone 8
Simulator Tested On:
Version of VS: 16.8.2
Version of Xamarin: 5.0-pre4
Versions of other things you are using: iOS 14.1
Steps to reproduce the Behavior
var files = await CrossMedia.Current.PickPhotosAsync(new PickMediaOptions
{
PhotoSize = PhotoSize.Full,
SaveMetaData = false,
}, new MultiPickerOptions());
- Chose "Selected photos" permission option when requested. Pick few photos
- Notice, that all collection items are there, but the thumbs are empty.
- There is an exception in the output window.
Failed to set thumbnail System.ArgumentNullException: Value cannot be null.
Parameter name: cgImage
at UIKit.UIImage..ctor (CoreGraphics.CGImage cgImage) [0x0006e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.4.1.3/src/Xamarin.iOS/UIKit/UIImage.g.cs:145
at Plugin.Media.ELCImagePickerViewController+ELCAlbumPickerController.GetCell (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) [0x00056] in d:\a\1\s\src\Media.Plugin\iOS\ECLImagePickerViewController.cs:399
Expected Behavior
Actual Behavior
Code snippet
var files = await CrossMedia.Current.PickPhotosAsync(new PickMediaOptions
{
PhotoSize = PhotoSize.Full,
SaveMetaData = false,
}, new MultiPickerOptions());
Screenshots
Just checked the source code, and it looks like that exception is not relevant to this specific bug. It's related to another issue that group (album) thumb cannot be generated.
This is due to the new photo library permissions introduced in iOS 14
This can be resolved by either requesting that the user grant full library access when prompted. Or by using a different picker controller for iOS (the ELC one is based on code that's about 10 years old now).
I've written an implementation to use the iOS 14 PHPicker controller in my own fork here if you want to try it out
https://github.com/matthewkapteyn/MediaPlugin
That all being said - @jamesmontemagno is soon to archive this repository and is recommending to switch to the microsoft developped Xamarin Essentials library. I have a few apps that use MediaPlugin in production so i'll be continuing to support this plugin in my own fork for a good while longer. Or at least until Xamarin Essentials adds multi-picking.
Also, wouldn't be fair not to shout out this fork by @bpater-tp
https://github.com/bpater-tp/MediaPlugin
Who did a great job implementing GMImagePicker to replace ELC. This picker controller also supports iOS 14.
Media picker is Essentials does not support picking multiple files.
And yes, choosing All photos permission is a workaround indeed.
I will check those 2 forks, thanks!
@IngweLand FilePicker is essentials support picking multiple files
https://docs.microsoft.com/es-es/xamarin/essentials/file-picker?context=xamarin%2Fandroid&tabs=android