Open alpha0010 opened 5 years ago
Same this issue when I upgrade from 0.10.13 to 0.10.14
Reverting to 0.10.13 fixes it and works perfectly for both operating systems for us.
Same issue for new version
@Traviskn
+1 0.10.14 causes a bug: https://github.com/wonday/react-native-pdf/issues/286
Can confirm with both 'fileCache: true' and 'path: randomPath' options, on iOS 12.0, RN-fetch-blob 0.10.14 and RN ^0.55
Same here, went back to 0.10.13
Removed a piece of code responsible for saving the file to disk... All broke their new vision ((( And the most interesting, why?
@Traviskn need your help
@legion-zver Thanks for finding the root cause, I should have been more thorough in my code review before merging #198 I think I'll revert that merge
I have reverted #198 and published a new release, so file saving should be working again
@Traviskn seems still not working
Same, reverting to 0.10.13 fixed it for me
update to 0.10.15 fixed it for me.
I'm in RN 0.57 and rn-fetch-blob 0.10.15. So when i try to download directly to a file with path:
it returns response.path()
correctly but there's no file. I don't know if i'm doing something wrong 😞 . I'm saving at DocumentDir
on iOS.
EDIT:
i've solved this by using WRITE_EXTERNAL_STORAGE
permission on Android.
And using this keys in info.plist for iOS:
<key> UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
As described here, to enable file sharing in the app Document folder.
For those who are still strugling with this, I'm using CameraRoll on iOS to save image since it supports by default:
On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs) or a local video file URI (remote or data URIs are not supported for saving video at this time).
If the tag has a file extension of .mov or .mp4, it will be inferred as a video. Otherwise it will be treated as a photo. To override the automatic choice, you can pass an optional type parameter that must be one of 'photo' or 'video'.
CameraRoll.saveToCameraRoll(
'https://url.com/picture.jpg',
).then(Alert.alert('Success', 'Photo added to camera roll!'));
same here
Go to info.plist and add key "Application supports iTunes file sharing" and set Boolean value to YES. You will be able to see your downloads in "Files" of your iPhone.
I'm still facing this issue on 0.12.0 release. I'm trying download file in ios simulator 14.
let PictureDir = fs.dirs.PictureDir; let options = { fileCache: true, appendExt: 'png', path: PictureDir + '/image' + Math.floor(date.getTime()) + ext, addAndroidDownloads: { //Related to the Android only useDownloadManager: true, notification: true, path: PictureDir + '/image' + Math.floor(date.getTime() + date.getSeconds() / 2) + ext, description: 'Image', }, };
Above are my configs. Any help on this will be appreciated?
` const { dirs } = RNFetchBlob.fs; RNFetchBlob.config({ fileCache: true, notification: true, path: RNFetchBlob.fs.dirs.DocumentDir+"/taskmanagementApp/"+Math.random().toString(36)+fileName[2],
})`
Please help god knows where it's saving in the emulator.
what i got to know is first view the file in IOS and IOS automatically then gives option to save file this is my code
import FileViewer from "react-native-file-viewer";
import RNFS from 'react-native-fs';
export const downloadforIos = async (url) => { // here url is your remote url
const fileUrl = url
const fileName = url.substring(url.lastIndexOf('/')+1)
const localFile = `${RNFS.DocumentDirectoryPath}/${fileName}`;
if(fileUrl !== null){
const options = {
fromUrl: fileUrl,
toFile: localFile
};
RNFS.downloadFile(options).promise
.then(() => FileViewer.open(localFile))
.then(() => {
console.log("opened")
// success
})
.catch(error => {
// error
console.log("error", error)
notifyMessage("No app found to open this file type")
});
}
}
Upon upgrading from 0.10.13 to 0.10.14, saving to a specified file on IOS has stopped working.
Under both versions, the first two logs give the same result (something like
[...]/Library/Developer/CoreSimulator/Devices/F3CE7938-1974-467C-8183-C1F98AC74CCE/data/Containers/Data/Application/8F3721D5-7CC6-4CEC-8D96-1AB6B4CB26E6/Documents/test.txt
) and the last yields an object with the appropriate information (includingstatus: 200
).If I navigate to
[...]/Documents/
folder when the app is built with 0.10.13,text.txt
exists. However, under 0.10.14, the folder remains empty.