Hello,
I am trying to download an image in my app using native plugin File in iOS. , this is the code I am using for iOS version:
Typescript file:
let folderpath = null;
if (this.platform.is('ios')) {
folderpath = this.file.dataDirectory;
} else {
folderpath = this.file.externalRootDirectory;
}
let filename = 'temp-image.png';
this.file.resolveLocalFilesystemUrl(folderpath).then((res) => {
this.file.writeFile(folderpath, filename, DataBlob, {replace: true}).then((success) => {
this.alertService.showPopup('Card successfully saved to image library', 'Save card success');
}).catch((err) => {
this.alertService.showPopup('Unable to save file', 'Save card error');
});
}).catch((error) => {
this.alertService.showPopup('Unable to save file', 'Save card error');
})
In Config xml:
<preference name="iosPersistentFileLocation" value="Library">
File is successfully getting stored and I get the alert providing the message in the code. But I am unable to find this file anywhere in my device. Also, I can make the app access the file it stores(like read and output the file as a base64 encoded data url with readAsDataUrl).
Is there any approach to download the files in iOS? I appreciate your time on this.
Thanks