apache / apache/cordova-plugin-file-transfer
Downloaded pdf files disappear after app rebuild on iOS platform
- Dominant language
- JavaScript
- Stars
- 606
- Forks
- 874
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
Downloaded PDF files disappear after an app rebuild on iOS platform
### What is expected to happen?
Downloaded files stay on the persistent storage permanently on iOS platforms
### What does actually happen?
Downloaded files are not found after an app rebuild on iOS platform.
## Information
I have downloaded PDF files from a website and then store the locations of the filenames on the local storage. Then I use FileOpener plugin to open PDF files. Whenever I rebuild the app, the file-opener cannot find any of the files on iOS platform -on Android, it is fine. I'm experiencing this issue for nearly 6 months or so. It used to work before perfectly. Please see the code snippet I use to download a pdf file.
### Command or Code
private downloadPDF(pdf: IPdf, callback: (data) => void) {
const fileTransfer: FileTransferObject = this.transfer.create();
fileTransfer.download(pdf.Location, this.file.dataDirectory + pdf.Name).then((entry) => {
if (this.platform.is('android')) {
this.filePath.resolveNativePath(entry.toURL())
.then(filePath => {
callback(filePath);
})
.catch(err => console.log(JSON.stringify(err)));
}
else {
callback(entry.toURL());
}
}, (error) => {
// handle error
});
}
### Environment, Platform, Device
I'm using Ionic Framework version 3.
Platforms: Android and iOS
### Version information
Ionic:
ionic (Ionic CLI) : 4.1.1
Ionic Framework : ionic-angular 3.6.0
@ionic/app-scripts : 3.1.8
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 6.4.0
Cordova Plugins : no whitelisted plugins (18 plugins total)
System:
Android SDK Tools : 26.1.1 (C:\Users\[USERNAME]\AppData\Local\Android\sdk)
NodeJS : v6.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.5.0
OS : Windows 10
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start by reproducing the iOS rebuild behavior around the download call using this.file.dataDirectory and the returned entry.toURL(). Inspect the plugin's iOS handling of downloaded files and compare it with the Android path; done means downloaded PDFs remain findable after an app rebuild on iOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100