Skip to content
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

Access the file created by react-native-fs by native ios Objective c code #554

Closed
yli18 opened this issue Sep 18, 2018 · 2 comments
Closed

Comments

@yli18
Copy link

yli18 commented Sep 18, 2018

It's more like a question rather than an issue.
I created a file using react-native-fs and want to read it at native module using objective c.

In my case the file path is:
/var/mobile/Containers/Data/Application/8BDBB76C-A803-4F75-88A7-77DFFBCF8388/Documents/test.md

[[NSFileManager defaultManager] fileExistsAtPath:filepath]
I tried to access it from ios native module with this file path but not succeed, even with "file://" prefix

What is the correct filePath format?

@maxkomarychev
Copy link

Are you reading file in the same session or after app restarts?
not sure this is the actual case but may be good to know that you should never store absolute paths for your files since they will be different every time you start the app: https://stackoverflow.com/a/27443165

@yli18
Copy link
Author

yli18 commented Dec 5, 2018

You are right, never to store absolute paths. At the beginning I tried resource path like "file://" which seems not working either.

Right now I'm using a work around, instead of create a file with react-native-fs, i create it in native module.

Thanks

@yli18 yli18 closed this as completed Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants