I have an hybrid app that works perfectly on iOS 7 using Cordova 3.7 and jQuery Mobile 1.3.2
I am testing it on iOS 8 and it is broken.
I am requesting each page(view) of my app using absolute paths, using the file://
protocol, like:
file:///var/mobile/Applications/<UUID>/MyApp.app/www/views/add-project.html
but i get the error:
Failed to load resource: The requested URL was not found on this server.
I read about this bug, is that the problem?
Also, on iOS 8, the location of the www folder is a bit different from iOS 7, it resolves to:
file:///var/mobile/Containers/Data/Application/<UUID>/MYApp.app/www/views/add-project.html
Is this correct?
I tried the toURL() and toInternalURL() methods to have the absolute paths like:
cdvfile://localhost/root/var/mobile/Containers/Bundle/Application/<UUID>/MyApp.app/
but I get always the same error.
Any suggestion?
Thanks
hit a similar problem, adding the WWW worked!
To whoever might find this useful, I finally manage to solve the problem.
The full path to the
www
folder on ios 8+ is:file:///private/var/mobile/Containers/Bundle/Application/<UUID>/<your_app>.app/www/
but when you request the application directory with Cordova, doing:
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, onSuccess, onError);
it will give you a wrong path (Cordova 3.7 on iOS 8.1.2) like:
file:////var/mobile/Containers/Bundle/Application/<UUID>/<your_app>.app/
using the toURL() method suggested on the docs
Therefore you need to manually do a bit of tweaking
and bingo!
I ran into the same problem and I managed to solve it. In my case, my problem was that every time I update the app, the new app has a different id than the last one. For instance, the path for the older app was:
And new one:
So even though my pdf files were still on the application data storage, I was using the wrong path since the app created a new application id. I solved this by creating a new function that updates my path every time there is an update. I find the application id by using:
The filesystem is an object contains the nativeURL inside the root.
Hope it helps!