From bf906b5a0c008131f1abd0b161e18e281a5a8a63 Mon Sep 17 00:00:00 2001 From: Andres Pineda Date: Wed, 8 May 2024 15:10:11 -0400 Subject: [PATCH] fix(iOS): multiple files selection --- src/Uno.UWP/Storage/Pickers/FileOpenPicker.iOS.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Uno.UWP/Storage/Pickers/FileOpenPicker.iOS.cs b/src/Uno.UWP/Storage/Pickers/FileOpenPicker.iOS.cs index 317fd1b8d7f5..0091c4fa0c9d 100644 --- a/src/Uno.UWP/Storage/Pickers/FileOpenPicker.iOS.cs +++ b/src/Uno.UWP/Storage/Pickers/FileOpenPicker.iOS.cs @@ -165,7 +165,10 @@ public PhotoPickerDelegate(TaskCompletionSource taskCompletionSo public override async void DidFinishPicking(PHPickerViewController picker, PHPickerResult[] results) { var storageFiles = await ConvertPickerResults(results); - _taskCompletionSource.SetResult(storageFiles.ToArray()); + + // This callback can be called multiple times, user tapping multiple times over the "add" button, + // we need to ensure that we only set the result once. + _taskCompletionSource.TrySetResult(storageFiles.ToArray()); } private async Task> ConvertPickerResults(PHPickerResult[] results) {