App stopped working on emulator and device. Stripped down code, still broken


I was creating an app but following some updates I’m no longer able to test it on the emulator or device.

I’ve stripped out the majority of my code just to see if I was doing something wrong. I’m unfortunately getting no error messages, and I’m wondering whether it’s a problem with my environment? I’m using Mac OSX 10.9.3.

I am unable to log to the console at this point, however we do get to this line.

If you git clone this project you should be able to run npm install and then gulp emulate to see exactly what I mean.

This is what I see inside the console.log produced by ionic emulate ios.

2014-06-08 13:46:00.612 Ionic App[83437:70b] Multi-tasking → Device: YES, App: YES
2014-06-08 13:46:00.623 Ionic App[83437:70b] Unlimited access to network resources
2014-06-08 13:46:00.650 Ionic App[83437:70b] [CDVTimer][statusbar] 6.989956ms
2014-06-08 13:46:00.650 Ionic App[83437:70b] [CDVTimer][TotalPluginStartup] 7.485032ms
2014-06-08 13:46:00.781 Ionic App[83437:70b] Resetting plugins due to page load.
2014-06-08 13:46:00.932 Ionic App[83437:70b] Finished load of: file:///Users/sebinsua/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/CC48195C-28FF-4138-88C4-90E02AA044CA/
2014-06-08 13:46:00.955 Ionic App[83437:70b] adding proxy for Contacts
2014-06-08 13:46:00.956 Ionic App[83437:70b] Ionic is ready.

I even have a repository in which I removed most of the dependencies and that’s also playing up…

Does anybody know why it’s not working? Can I troubleshoot my environment in anyway? I was just planning on finishing my MVP and then going ahead and rewriting it with Swift but at this point I’m wondering whether to bother. There’s something really annoying with the fact it’s silently failing with no error messages. I don’t know what to troubleshoot. Any way of getting more errors/verbosity than I have?

My guess would be that you’ve messed up your routing.

In your app.config section, check this line of code to make sure you are pointing to a valid route:


You may also want to put some error reporting for $stateChangeError and $stateNotFound in your section. See this post :

        $rootScope.$on("$stateChangeError", function(event, toState, toParams, fromState, fromParams, error) {

        $rootScope.$on("$stateNotFound", function(event, unfoundState, fromState) {

I added those lines and it doesn’t give me any error messages.

The funny thing is that it’s loading the template and not running the code inside the controller that’s related to this.

If I just bring up a local server and use the browser then it all works?! Does that mean something is wrong with Cordova?

Nobody has any idea how to troubleshoot?

I just need somebody to take a minute and tell me that it’s my environment or my code.

Well, it could point to the fact that there’s a plugin related issue going on. It could be you’re calling a plugin from your code that has gotten damaged and needs to be reinstalled.

Maybe the Contacts plugin? That would explain why your project does work on the desktop at least.

Try not calling any plugin related code in your project and removing all plugins by using cordova plugins rm <name of plugin> and recompiling.

The trick is to keep removing functionality until your app successfully compiles on device so you determine what exact functionality is breaking your project.

Is there a bug tracking this, to the effect of “Apps should not silently fail on devices due to bad plugins”?

The failure should happen, obviously, but nothing should ever silently fail if it can possibly be helped. What a silent failure means to anyone who values their sanity is “Error: You should not be using this framework.” You’ll notice this reflected in the suggested solution – not “look for more information about what is causing the problem” but “do a binary search of literally every plugin in your codebase, where each phase of the search must be something that should run on the device, and if the problem is indeed a plugin problem, you will have found it.”