Path to downloaded content is no longer valid after app update
Opened this issue · 0 comments
Menardi commented
Expected Behaviour
The path returned in the completion handler (data.localPath
) will always point to the downloaded data, across app updates.
Actual Behaviour
When the app is updated, it seems that iOS assigns the app a new UUID. Since the path returned in the completion handler is based on the UUID, it is no longer valid.
For now, my workaround has been to use cordova-plugin-file to determine the path dynamically (cordova.file.dataDirectory
with the name of the zip's folder added).
Steps to Reproduce
- Create a new Cordova app with cordova-ios
- Create a zip file with an image in it
- Download this zip file using this plugin, and save
data.localPath
in the completion handler - Use this saved path to display the image in app
- Bump the version of the app in config.xml (e.g. from 0.0.1 to 0.0.2), and re-run the app
- The image no longer displays, as the path is no longer valid
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iOS 12.1.1
Cordova CLI version and cordova platform version
cordova 8.1.2
cordova-ios 4.5.4
Plugin version
1.4.2