When running ionic emulate ios or ionic run -l -c -s my app works fine on my iphone 5s. But if I export the app and load it via itunes, I only get a white screen and the app does not load at all.
index.html loads and the js loads, I can console.log things in app.js, but ionic.run does not appear to do anything.
Console log:
2015-01-24 17:18:24.980 moodtracker2[228:5933] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/2F9A42BE-617E-4D96-92F6-9BFB5DF7A6DF/Library/Cookies/Cookies.binarycookies
2015-01-24 17:18:25.185 moodtracker2[228:5933] Apache Cordova native platform version 3.7.0 is starting.
2015-01-24 17:18:25.186 moodtracker2[228:5933] Multi-tasking -> Device: YES, App: YES
2015-01-24 17:18:25.190 moodtracker2[228:5933] Unlimited access to network resources
2015-01-24 17:18:25.310 moodtracker2[228:5933] [CDVTimer][keyboard] 0.209033ms
2015-01-24 17:18:25.311 moodtracker2[228:5933] [CDVTimer][localnotification] 0.641048ms
2015-01-24 17:18:25.311 moodtracker2[228:5933] [CDVTimer][localnotification] 0.014007ms
2015-01-24 17:18:25.311 moodtracker2[228:5933] [CDVTimer][TotalPluginStartup] 1.690984ms
2015-01-24 17:18:25.849 moodtracker2[228:5933] Resetting plugins due to page load.
2015-01-24 17:18:26.264 moodtracker2[228:5933] Finished load of: file:///private/var/mobile/Containers/Bundle/Application/1575253E-AE3E-4748-8404-92DD06D87FE3/moodtracker2.app/www/index.html
Console when working in xcode emulator:
2015-01-24 17:15:58.226 moodtracker2[76670:300297] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/tomchambers/Library/Developer/CoreSimulator/Devices/DE31845A-54DD-42FE-BD93-3222C106F55F/data/Containers/Data/Application/168B055F-807E-4CDE-B7CE-448738D1C3D3/Library/Cookies/Cookies.binarycookies
2015-01-24 17:15:58.456 moodtracker2[76670:300297] Apache Cordova native platform version 3.7.0 is starting.
2015-01-24 17:15:58.456 moodtracker2[76670:300297] Multi-tasking -> Device: YES, App: YES
2015-01-24 17:15:58.461 moodtracker2[76670:300297] Unlimited access to network resources
2015-01-24 17:15:59.161 moodtracker2[76670:300297] [CDVTimer][keyboard] 0.135005ms
2015-01-24 17:15:59.162 moodtracker2[76670:300297] [CDVTimer][localnotification] 0.331044ms
2015-01-24 17:15:59.162 moodtracker2[76670:300297] [CDVTimer][localnotification] 0.012994ms
2015-01-24 17:15:59.162 moodtracker2[76670:300297] [CDVTimer][TotalPluginStartup] 1.106977ms
2015-01-24 17:15:59.881 moodtracker2[76670:300297] Resetting plugins due to page load.
2015-01-24 17:16:00.286 moodtracker2[76670:300297] Finished load of: file:///Users/tomchambers/Library/Developer/CoreSimulator/Devices/DE31845A-54DD-42FE-BD93-3222C106F55F/data/Containers/Bundle/Application/8CA3E49E-C3BC-4572-8F4D-BC62E60F805B/moodtracker2.app/www/index.html#/tab/dash
The problem was a module not being dependency injected properly.
i have the same issue, how did you find the dependency not properly injected ?
It was some time ago but I think I added these lines to app.js:
window.onerror = function (errorMsg, url, lineNumber) {
alert('Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber);
}
Could be any javascript error that prevents the app from loading, but this will highlight what it is. Otherwise it'll just crash with no clue as to why.
thanks for taking the time to answer me you saved my day :+1: !!
In my case the issue was a wrong cased letter into a script tag src path :-|
For the next follow you may wana put the above snipet in a script tag at the top of the head of your index.html file
Thanks again @tomchambers2 !!
Thanks!!!!!!!! Solved!
Thanks @tomchambers2 !
That's a really great debugging method for cordova-ios js errors.
@tomchambers2 What can I do, if even the error alert box doesn't show up?
@patrickhofer Try putting an alert('cordova app running') in the very first line of your index.html. If that doesn't show up you'll know that it's not to do with the javascript execution but the cordova app itself starting (i.e. a config/objective C issue).
@tomchambers2 is now my hero
Solution worked - even the xcode debugger didn't show anything like this. Thanks!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
It was some time ago but I think I added these lines to app.js:
Could be any javascript error that prevents the app from loading, but this will highlight what it is. Otherwise it'll just crash with no clue as to why.