I'm looking for a way to access the Files.app directory mainly the "Downloads" directory but the directory marked as "On My iPhone" would work as well. The use case will be a user downloads a certificate outside of the app into Files.app and the app will browse the directory for that certificate. I am using 'react-native-fs' and have tried using several file directory paths provided by the library such as DocumentDirectoryPath
and LibraryDirectoryPath
. I have also added UISupportsDocumentBrowser
to the info.plist
all with no luck.
Just for testing I am using:
RNFS.readDir(RNFS.DocumentDirectoryPath).then(files => {
console.log(files);
})
.catch(err => {
console.log(err.message, err.code);
});
The file manager cannot magically "see" into the Files app world. That world belongs to the Files app! You are sandboxed. You can allow the user to choose a file from the Files app using the documents browser, but you can't just magically peer into it.