dotnet / maui-samples

Samples for .NET Multi-Platform App UI (.NET MAUI)
https://dot.net/maui
MIT License
3.15k stars 1.28k forks source link

Share.RequestAsync() doesn't work on .Net MAUI #464

Closed CherryBu closed 6 months ago

CherryBu commented 6 months ago

I use the following code to share Text or Files in Maui iOS, it works fine in my test sample project. But it don't work in my another project that adding Identifiers, share dialog don't appear, I search some info, but don't get any solution.

I have added these key in Info.list.

`NSPhotoLibraryAddUsageDescription

This app needs access to the photo gallery to save photos and videos. NSPhotoLibraryUsageDescription This app needs access to the photo gallery to save photos and videos.` Sharing Text ` await Share.Default.RequestAsync(new ShareTextRequest { Text = "Hello word!!!!!", Title = "Share Text" }); ` Share single file ` string fn = "Attachment.txt"; string file = Path.Combine(FileSystem.CacheDirectory, fn); File.WriteAllText(file, "Hello World"); await Share.Default.RequestAsync(new ShareFileRequest { Title = "Share text file", File = new ShareFile(file) }); `
jfversluis commented 6 months ago

This is not an (official) support channel for .NET MAUI. You probably want to go to the .NET MAUI repository Discussions tab, Microsoft Q&A or a third-party forum like Stack Overflow for these types of questions.

Good luck!