joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.84k stars 784 forks source link

PDF File is not found on device after saving on ios #660

Open Yasernova opened 4 years ago

Yasernova commented 4 years ago

const download = async () => { const createAndPerview = () => saveFile( ${path}/${fileName}-${moment().format('YYYY-MM-DD HH:MM:SS').split(' ').join('-')}.png`, data, 'base64') .then((res) => { console.log(res); // logs the bytes size notificationToast('success', i18n.t('saved')); }).catch(console.warn);

try {
  if (Platform.OS === 'android') {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE);
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      createAndPerview(Platfrom.OS);
    }
  } else {
    createAndPerview(Platfrom.OS);
  }
} catch (e) {
  console.warn(e);
}

};`

asit-prakash commented 3 years ago

I used this method and it's working fine..

//For IOS if (Platform.OS === 'ios') { RNFetchBlob.config({ fileCache: true, appendExt: extension, }) .fetch('GET', url) .progress((received, total) => { // console.log('progress', (received / total) * 100); setFileLoading(true); }) .then((res) => { setFileLoading(false); RNFetchBlob.ios.openDocument(res.path()); }); }

lamaji commented 3 years ago

Can you help me to solve this issue please #698 thanks.