I’m trying to run an app on IOS and failing to do so because my application files are not being found.
I tried running from XCode and then looking in the Safari developer console for my app, and it looks like the WebView is simply not finding the files.
However, when I check the contents of the app (doing a ‘Show package content’) in the Finder, I find that my files are rightly there (e.g, index.html is under www and main.js is under www/build).
I’m using Ionic’s app-scripts v 2.1.3.
Also, I tried removing the IOS platform and re-adding it afterwards, with no effect (ionic cordova platform rm/add ios).
The app works perfectly in web mode (using ionic serve)
It just, somehow, seems to not be able to find the app files…
Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Safari dev tools: https://ionic.zone/debug/remote-debug-your-app#ios Look at the console and network tabs for errors.
I’m referencing those files in a totally standard way:
[...]
<link href="build/main.css" rel="stylesheet">
</head>
<body class="page__body">
<!-- Ionic's root component and where app-page app will load -->
<ion-app></ion-app>
<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>
<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>
[...]
Do these files actually exist in your www or www/build folder you have locally?
It seems to not be able to find anything but index.html, right?
How exactly did you build your app?
You might want to upgrade these to more recent versions. (Note the breaking changes at app-scripts 2.x in the changelog)
I can confirm that those files are indeed under www (index.html) and www/build (main.js, main.css, etc):
I ran ionic cordova build ios, then opened my .xcodeproj file under platforms/ios and edited it to specify my development team, then from XCode, I hit the ‘play’ button:
To debug, I opened Safari and went to the Develop Menu / My Ipad / My App
I can reload the index page in the WebView, and always get the same result:
Hm, I am quite sure we are missing something here.
Can you right click on the first file that is not loaded and “Copy link address” and paste it here?
Should look something like file:///Users/sujan/Library/Developer/CoreSimulator/Devices/EDDDD4B6-81EB-48FD-A18B-1D631E3F8222/data/Containers/Bundle/Application/23932B49-F50B-4A65-A645-8A37A79F6EBF/Za%CC%88hlerstand.app/www/index.html
index.html (which loads successfully) is more like your example: file:///Users/candide/Library/Developer/CoreSimulator/Devices/7D193B8D-F40E-4C73-A4B6-DCF1B05067C9/data/Containers/Bundle/Application/93572C45-CA58-44CE-B490-6ABB5D443BCE/lify-ng2.app/www/index.html
I switched to the context of an iPad simulator for this (previously I used a real device, so I don’t know if the result would have been different).
Get also rid of the hotjar.js temporarily. Quite a lot of differences to the default index.html here
(Should have asked you to try with a new project via ionic start blank blank much sooner…)
Please create a new project with ionic start blank blank and try to build that. Then we know if it is your project or a problem with your system in general.