itinance / itinance/react-native-fs

App crashes in production when trying to writeFile

Open
#536 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm having a problem only on the production build on iOS. I'm trying to save a file, which will be shared using the react-native Share component.

This is what I'm trying to do, using `mkdir` and `writeFile` from react-native-fs.

```
const directoryPath = `${DocumentDirectoryPath}/Test/${id}/`;
const path = `${directoryPath}/${name.split(' ').join('_')}.csv`;
mkdir(directoryPath, { NSURLIsExcludedFromBackupKey: true })
.then(() => writeFile(path, csvString, 'utf8'))
.then(() => {
this.setState(
{
generatingFile: '',
},
() => {
Share.share({
message: `Here is your file`,
url: `file://${DocumentDirectoryPath}/Test/${id}/${name
.split(' ')
.join('_')}.csv`,
subject: `Your file`,
title: `Your file`,
});
}
);
})
```

The problem is I don't know how to debug the app, given that it only crashes in production. Can it be something with trying to create a directory in an illegal location?

Thank you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.