vinzscam/react-native-file-viewer

App crashes on IOS

Atikur-Rahman-Sabuj opened this issue · 1 comments

App crashes without any error log or message when trying to open file with ios

Here is log of fileLocation:
{"fileLocation": "/Users/sabuj/Library/Developer/CoreSimulator/Devices/83167C9E-C22F-4CB4-944E-FCA3C281FEF4/data/Containers/Data/Application/7079B2B7-3029-4C7C-B74E-6B2257D569ED/Downloads/Taskmaster.pdf"}

The file exist on this location I checked.

Code snippet:

let fileLocation = RNFetchBlob.fs.dirs.DownloadDir + '/' + fileName;
RNFetchBlob.fs
.writeFile(fileLocation, byteArray, 'base64')
.then((response) => {
if (response > 0) {
try {
FileViewer.open(fileLocation, {
showOpenWithDialog: true,
showAppsSuggestions: true
})
.then(() => {
console.log('FileViewer open');
})
.catch((error) => {
console.log({ error });
Alert.alert(
"Can't open file. File has been downloaded."
);
});
} catch (error) {}
} else {
Alert.alert('File open failed, Try again!');
}
})

After more analysing, I found that this is because of M1 processor and this repository already have a issue open for this. So closing this one.