
React Native 앱에서 다운로드된 파일을 파일앱으로 열고자 하였다.
다운로드 후 notifee 를 display해주는데, 해당 알림을 터치하였음에도 파일이 열리지 않는 오류가 발생했다. (android는 정상 작동)
파일 앱에 파일은 존재하지만, 알림 터치 시에는 파일이 열리지 않는 상황
기존에 RNFetchBlob.ios.previewDocument 를 사용했지만 알림이 나타나고 약 5분 후에나 알림 터치 시 파일을 확인할 수 있었다
RNFetchBlob.ios.openDocument 는 다운로드 완료 알림이 나타나고 약 5초 후에 알림을 터치하면 파일이 열린다(!)
/* 수정 전 */
RNFetchBlob.ios.openDocument(path);
/* 파일이 존재하는지 확인 */
RNFetchBlob.fs.exsists(path)
.then((exists) => {
if (exists) {
...
}
else {
console.log('파일 없음');
}
})
파일도 존재했다..
/* 수정 후 */
import FileViewer from 'react-native-file-viewer';
...
FileViewer.open(파일경로)
.then(() => {})
.catch(error => {
console.log(error);
})
...