ionic-cache-src
ionic-cache-src copied to clipboard
iOS - Cached images not found
Hi,
where exactly does this plugin store the files on iOS?
I use var localUrl = cordova.file.dataDirectory; what resolves to file:///var/mobile/Containers/Data/Application/<UUID>/Library/NoCloud/
If the device is offline I receive this error:
Failed to load resource: file:///var/mobile/Containers/Data/Application/<UUID>/Library/NoCloud/eroq1wz4bJTzfEbT.jpg
The requested URL was not found on this server.
On Android all works fine.
On top I had to change the code block starting at: https://github.com/BenBBear/ionic-cache-src/blob/master/ionic-cache-src.js#L169
to avoid returning undefined:
c.get = function(url) {
var result = undefined;
if (needDownload(url)) {
var cache_url = c._cache[url] && (getCacheDir() + c._cache[url]);
result = cache_url || url;
}
return result;
};
Thanks for your advice(s).
The function getCacheDir() is not defined within the factory. It needs to be defined there!