How do I copy files from a selected directory to the application directory?

2024-09-10T06:37:54.0166667+00:00

How do I copy files from a selected directory to the application directory in iOS using C#?

I am using a folder picker from the Community Toolkit to select the directory. After selecting the directory, I try to get a list of files in the directory using the Directory.GetFiles() method. However, this causes an error: "Access to the path 'SelectedFolderPath' is denied". This happens when running on iOS, but not on the iOS simulator. How can I fix this error? Do I need to modify the info.plist file for permissions, like Android's manifest file?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,541 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.