I’m at my wits’ end troubleshooting this problem. There does not seem to be any useful information on the topic out there so far.
I simply cannot get cordova.js to load on any project in iOS simulator. No amount of reinstalls, cache-clearing, or upgrades for any of ionic, cordova, or npm will fix the problem, from anywhere between ionic 1.7.8 - 1.7.13, cordova 5.3.3 - 5.4.1, and npm 2.7.4 - 3.5.3. I did not use sudo
to install any of these.
I have even tried creating a new blank project with no plugins to see if my code or any of the installed plugins were causing the issue. Cordova.js still fails to load.
I am building the project in Xcode 7.2 (on OS X El Capitan 10.11.2) after ionic platform remove ios
and ionic platform add ios
every time I make a change to my code or environment. I am deploying to iPhone 6S Plus on Simulator. (Using ionic emulate ios
launches iPhone 6 simulator, but the app is never loaded onto the simulated device despite terminal displaying BUILD SUCCEEDED
and RUN SUCCEEDED
.)
I can very clearly see that cordova.js is right there in platforms\ios\www, but when inspecting Simulator in Safari, cordova.js is highlighted in red with “An error occurred trying to load the resource”, which is the same message that I get for script files that don’t exist during testing.
The problem exists on hard devices as well. I had a project that I deployed to an iPad that failed to load any plugins, and therefore could not use $cordovaSQLite due to Error: undefined is not an object(evaluating 'n.sqlitePlugin.openDatabase') openDB@file:///<...>ng-cordova.min.js:9:17883
. I reproduced this problem in simulator where cordova.js similarly was not loading. (This $cordovaSQLite issue is not related to $ionicPlatform.ready()
.)
The problem does not affect Android, which I am building on Windows 7. On that environment, I am able to inspect cordova.js when using Chrome to inspect my project on a device connected via USB.
Has anyone else experienced this problem?