I am having the exact same issues explained in https://github.com/dotnet/maui/issues/11088.
and checked FilePicker throwing an exception on mac OS with .net MAUI answer added
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
to Entitlements.plist
Dotnet workloads on development machine (Windows);
Installed Workload Id Manifest Version Installation Source
---------------------------------------------------------------------
maui-windows 8.0.6/8.0.100 VS 17.10.34607.79
maccatalyst 17.2.8022/8.0.100 VS 17.10.34607.79
android 34.0.79/8.0.100 VS 17.10.34607.79
ios 17.2.8022/8.0.100 VS 17.10.34607.79
and dotnet workloads on publishing machine (Mac);
Installed Workload Id Manifest Version Installation Source
---------------------------------------------------------------------
wasm-tools 8.0.2/8.0.100 SDK 8.0.200
macos 14.2.8022/8.0.100 SDK 8.0.200
maui-maccatalyst 8.0.6/8.0.100 SDK 8.0.200
maui-ios 8.0.6/8.0.100 SDK 8.0.200
maui-android 8.0.6/8.0.100 SDK 8.0.200
ios 17.2.8022/8.0.100 SDK 8.0.200
maui 8.0.6/8.0.100 SDK 8.0.200
There is a approved and merged PR for this issue; https://github.com/dotnet/maui/pull/13814 and more over, this issue has been deemed as fixed on Jul 12, 2023 https://github.com/dotnet/maui/issues/11088#event-9792279528 Alas, when I lookup the sources of relevant code area from Visual Studio I am not able to see fixed code. (Its just #if/#endif which is not there!)
The following code is used to pick text files;
Project is open source and repository address is; https://github.com/Buyukcaglar/UltimateRemote
https://github.com/Buyukcaglar/UltimateRemote/blob/main/Constants/FilePickerOptions.cs Line 15 & 264
public static PickOptions TextFileOptions = new()
{
PickerTitle = "Select a TXT file",
FileTypes = TxtFile,
};
private static readonly FilePickerFileType TxtFile = new FilePickerFileType(
new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.iOS, new[] { "public.text" } },
{ DevicePlatform.Android, new[] { "text/plain" } },
{ DevicePlatform.WinUI, new[] { ".txt" } },
{ DevicePlatform.Tizen, new[] { "*/*" } },
{ DevicePlatform.macOS, new[] { "public.text" } },
{ DevicePlatform.MacCatalyst, new[] { "public.text" } }
});
https://github.com/Buyukcaglar/UltimateRemote/blob/main/Services/StorageContentFileService.cs Line 51:
var pickResult = await FilePicker.PickAsync(FilePickerOptions.TextFileOptions);
FilePicker.PickAsync or FilePicker.Default.PickAsync does not matter, result is null regardless.
Am I missing something, or doing anything wrong? Any help appreciated.
Thanks,