dimonovdd / Xamarin.MediaGallery

This plugin is designed to picking and save images and video files from native gallery of Android and iOS devices and capture photos
MIT License
149 stars 18 forks source link

Cant pick more than 10 images from gallery at once iOS MAUI #126

Open ajay-mundi opened 7 months ago

ajay-mundi commented 7 months ago

Description

I have some users that want to be able to select a lot of photos at once (up to 200). But they are only able to select a maximum of 10. This issue only presents on iOS

Actual Behavior

Can only select 10 photos with a selection limit of 200.

Expected behavior

Should be able to select up to the number in the selection limit

Steps to reproduce the behavior

  1. Set selection limit to a number greater than 10
  2. Try to select that many from gallery
  3. Limited at 10

Screenshots or Videos

Reproduction Link

Configuration

beeradmoore commented 7 months ago

Hey @ajay-mundi , would you be able to show a sample of how you are using the picker so I can dump that into a new MAUI project and compare and see if I have the same result?

ajay-mundi commented 7 months ago

Hi @beeradmoore, thanks for the quick response. You can probably just use this method in the code behind of the mainpage attached to the default button in the default maui project.

public async void ChoosePhotoFromGallery()
    {
        var cts = new CancellationTokenSource();
        IMediaFile[] files = null;
        galleryItems = new List<GalleryItem>();

        try
        {
            var request = new MediaPickRequest(200, MediaFileType.Image, MediaFileType.Video)
            {
                PresentationSourceBounds = System.Drawing.Rectangle.Empty,
                UseCreateChooser = true,
                Title = "Select",

            };

            cts.CancelAfter(TimeSpan.FromMinutes(5));

            var results = await MediaGallery.PickAsync(request, cts.Token);
            files = results?.Files?.ToArray();
        }
        catch (OperationCanceledException oxe)
        {
            // handling a cancellation request

        }
        catch (Exception ex)
        {
            // handling other exceptions

        }
        finally
        {
            cts.Dispose();
        }
}
beeradmoore commented 7 months ago

Thanks for the code. I dumped that in the OnCounterClicked, added async, removed the galleryItems = new List<GalleryItem>(); line, and installed Xamarin.MediaGallery v2.2.1 but I was not able to replicate on iOS simulator or physical device (iOS 17.3.1).

I didn't do any of the optional stuff from the main readme here.

Does this work for you or are you getting the same behaviour as above?
MediaGalleryTest1.zip

ajay-mundi commented 7 months ago

With a simulator I am able to get it to work with over 10 photos but with a physical device (gen 9 ipad 17.3.1) on selection of the 10th photo I am no longer allowed to select any. The selection area becomes grayed out.

dimonovdd commented 6 months ago

The library does not make any restrictions, all restrictions are at the iOS level