Код: Выделить всё
Microsoft.Maui.ApplicationModel.NotImplementedInReferenceAssemblyException: This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
at Microsoft.Maui.ApplicationModel.DataTransfer.ShareImplementation.PlatformRequestAsync(ShareFileRequest request) in /_/src/Essentials/src/Share/Share.netstandard.tvos.watchos.cs:line 11
at Microsoft.Maui.ApplicationModel.DataTransfer.ShareImplementation.RequestAsync(ShareFileRequest request) in /_/src/Essentials/src/Share/Share.shared.cs:line 129
string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
Directory.CreateDirectory(documentsPath); //Also added this line because of the Xamarin to MAUI upgrade
string filePath = System.IO.Path.Combine(documentsPath, "SomeRandomFile.txt");
var shareRequest = new ShareFileRequest { Title = "Share file", File = new ShareFile(filePath) };
try
{
await Share.Default.RequestAsync(shareRequest);
}
catch (Exception ex)
{
string message = ex.Message;
}
< /code>
Когда я пытаюсь позвонить в строку в Try, это всегда приведет к исключению выше. И я понятия не имею, какой пакет ссылается на исключение ... и в решении есть только один проект, в котором есть все пакеты Nuget. Я просто хочу поделиться файлом. Я использую устройство с Android 14, и оно работало нормально, прежде чем я «вверх», оцениваемый от Xamarin до Maui. И пока это единственное препятствие, которое мне не удалось исправить себя, не прибегая к публикации этого вопроса.
Подробнее здесь: https://stackoverflow.com/questions/794 ... -upgrading
Мобильная версия