ionic 3
I am using #cordova-plugin-file-transfer, to download the file from url in android and ios. For Android it is working fine. But for ios app, i am facing a problem.
The file is downloading successfully, but i am not able to see downloaded file on ios device.
Here is my code for ios =>
const transfer = this.transfer.create();
transfer.download(url, cordova.file.documentsDirectory + fileName).then(
entry => {
console.log(entry);
this.apiService.showError("Download Succeeded.");
this.commonService.dismissLoading();
},
error => {
console.log(error);
this.apiService.showError("Download Failed.");
this.commonService.dismissLoading();
}
)
is there any one who can help me in this.
<preference name="iosPersistentFileLocation" value="Library" />
<preference name="iosPersistentFileLocation" value="Compatibility" />
There are two valid locations to store persistent files on an iOS device: the Documents directory and the Library directory. Previous versions of the plugin only ever stored persistent files in the Documents directory. This had the side-effect of making all of an application's files visible in iTunes, which was often unintended, especially for applications which handle lots of small files, rather than producing complete documents for export, which is the intended purpose of the directory.
It is now possible to choose whether to store files in the documents or library directory, with a preference in your application's config.xml file. To do this, add one of these two lines to config.xml
来源:https://stackoverflow.com/questions/55041701/download-file-in-ios-for-ionic-3-not-showing-in-files-folder