Closed joshua-augustinus closed 3 years ago
are you storing it somewhere persistent? or in a temporary storage location that's prone to purging?
I didn't set the filepath so am using whatever the default is.
I tried again using DocumentDir
const shouldCache = true;
const dirs = RNFetchBlob.fs.dirs
//Init
return RNFetchBlob
.config({
// add this option that makes response data to be stored as a file,
// this is much more performant.
fileCache: shouldCache,
// by adding this option, the temp files will have a file extension
path: dirs.DocumentDir + '/path-to-file.jpg'
})
And it worked on a real device but not on simulator.
After further testing it seems the issue is just the simulator. It works with unspecified filepath on real device but not simulator.
For anyone who has the same issue also note that the DocumentDir on IOS is dynamic on building and installing the app a second time. So you have to store the filename and add that to the document dir rather than saving the whole path.
I'm downloading an image then saving the filepath to storage. then on next bootup check the filepath; if it exists then use that as the source for the image. Example:
On Android it works fine. But on ios it doesn't work.
I have a sample repo here: https://github.com/joshua-augustinus/training-storage