itinance / itinance/react-native-fs
Missing instructions on how to make appear files into "File" app on iOS (with fix)
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
The thing is pretty straightforward. The guides on how to use RNFS do not explain carefully that **iOS hides by default the files that you save**. Every app in iOS has its "sandbox" when they can write/read without any major restrictions, but by default users aren't able to see any files. This could be potentially a problem if saved files are needed for the final user.
On Android this problem does not exist, since you can write, for example, in `Download` folder, if storage access is granted.
This was very unclear for me: the functions as `write` or `exists` was working: they both was returning `ok` when finishing saving or checking if file exists, but I couldn't see the files in the `File` app. Since I have some apps installed on my device, I saw that everyone has his folder inside `on My iPhone` but mine didn't.
After 2 days spending on understanding what permissions do I need or what I'm doing wrong, I discovered that **you need to explicitly indicate to iOS that your app is able to "expose" internal files**, in order to make it visible inside `File` app. Solution is very easy: just add this lines into your `info.plist` file (located in ios folder in your react-native project):
```
....
UIFileSharingEnabled
LSSupportsOpeningDocumentsInPlace
UISupportsDocumentBrowser
```
This will indicate that your app is exposing file saved inside `RNFS.DocumentDirectoryPath` and user can access them with the `File` app.
It would be great to add this instruction to README.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.