Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilePicker Does not show in Mac Catalyst #20994

Closed
mcferry opened this issue Mar 4, 2024 · 5 comments
Closed

FilePicker Does not show in Mac Catalyst #20994

mcferry opened this issue Mar 4, 2024 · 5 comments
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Milestone

Comments

@mcferry
Copy link

mcferry commented Mar 4, 2024

Description

File Picker does not show up at all on mac catalyst. and application stays on the await of PickAsync command.

Version 17.6.9 (build 415)
Runtime
.NET 8.0.201 (64-bit)
Architecture: maccatalyst-x64

    var file = await FilePicker.PickAsync(new PickOptions
    {
        PickerTitle = "Pick your Image",
        FileTypes = FilePickerFileType.Images
    });
	if(file==null)
	{
		return;
	}
	else
	{
		...
	}

Steps to Reproduce

Create a new .NET Maui App
Use code above inside the counter button to select a file.

Link to public reproduction project repository

na

Version with bug

8.0.6 SR1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

Sonoma 14.1

Did you find any workaround?

No

Relevant log output

No response

@mcferry mcferry added the t/bug Something isn't working label Mar 4, 2024
@PureWeen PureWeen added platform/macOS 🍏 macOS / Mac Catalyst area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info labels Mar 4, 2024
@PureWeen PureWeen added this to the Backlog milestone Mar 4, 2024
@ghost
Copy link

ghost commented Mar 4, 2024

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@mattleibow
Copy link
Member

Duplicate of #15126

@mattleibow mattleibow marked this as a duplicate of #15126 Mar 4, 2024
@mcferry
Copy link
Author

mcferry commented Mar 4, 2024

it's not a duplicate. it returns null after showing the open file dialog. but I cannot even see the open file dialog.

@o-l-i-g
Copy link

o-l-i-g commented Mar 19, 2024

@mcferry Did you add entries to the entitlements file (not info.plist)?
For local debug you shouldn't need to do the capabilities and provisioning profile to see the dialog popup - but you do need to append entitlements file.

https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/file-picker?view=net-maui-8.0&tabs=macios#get-started

<key>com.apple.security.assets.movies.read-only</key>
<true/>
<key>com.apple.security.assets.music.read-only</key>
<true/>
<key>com.apple.security.assets.pictures.read-only</key>
<true/>
<key>com.apple.security.files.downloads.read-only</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.personal-information.photos-library</key>
<true/>

Also in case it's a typo - if you're adding code to code behind file you should use

FileResult? selectedFile = await FilePicker.Default.PickAsync();

and not FilePicker.PickAsync

(FYI the above line for me works on macOS to show the dialog. But unfortunately it always returns null after selecting files at this moment of time)

@mcferry
Copy link
Author

mcferry commented Mar 22, 2024

<key>com.apple.security.assets.movies.read-only</key>
<true/>
<key>com.apple.security.assets.music.read-only</key>
<true/>
<key>com.apple.security.assets.pictures.read-only</key>
<true/>
<key>com.apple.security.files.downloads.read-only</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.personal-information.photos-library</key>
<true/>

Mate Thanks a lot. now It is working and you also are right it returns null.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants