-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing instructions on how to make appear files into "File" app on iOS (with fix) #1132
Comments
I have one question. Do the files persist after performing an app update on iOS? I am currently using another library and after implementaion, I found out that the absolute paths to the files change whenever an update is performed through Testflight. Any ideas how to persist the paths to local files after updates? Thanks. |
Actually I don't know. I saw that our iPhones updates some days ago and I can check if our test files are still there. But I don't know about this, since I'm not a proper iOS dev :) |
BRAVOOOOOOOOOOO <3 |
Thanks alot, you just saved my day <3 |
thanks a lot. this really should be added in the readme |
indeed applicationID is changes every time you update the app (TestFlight, build new release-scheme app locally, etc) - thus, if you are storing somewhere the full path to your file it will become invalid because your applicationID had changed. You either should always use dynamic value of RNFS.DocumentDirectoryPath or check is file exists every time you try to access it. |
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
orexists
was working: they both was returningok
when finishing saving or checking if file exists, but I couldn't see the files in theFile
app. Since I have some apps installed on my device, I saw that everyone has his folder insideon 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 yourinfo.plist
file (located in ios folder in your react-native project):This will indicate that your app is exposing file saved inside
RNFS.DocumentDirectoryPath
and user can access them with theFile
app.It would be great to add this instruction to README.
The text was updated successfully, but these errors were encountered: