Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Ionic - App stopped unexpectedly

Ardoid app stopped unexpectedly.

The link to the controller file is: https://www.dropbox.com/s/d0lc34q3mzlgfkj/controllers.js?dl=0

The problem occured after I updated my OSX to El capitan. Before updating the app would launch perfectly in the emulator. Now even if I build the APK and try to install it on a phone, it would not install.

Below is an image of my log file:

enter image description here

What am I doing wrong?

like image 689
Karthik Priyadarshan Avatar asked May 31 '16 07:05

Karthik Priyadarshan


1 Answers

Ok, so I find a lot of things that could be causing this problem for you.

First of all please consider using $stateProvider to declare your states and set the controllers per state so they won't load all at the same time and upon running the application (not sure if you have just set all the code into one file to show us what you have). But you know in your angular config set:

Example of using the $stateProvider:

$stateProvider
  .state('app.page1', {
    url: '/page1',
    templateUrl: 'templates/page1.html',
    controller: 'Page1Ctrl'
    }
});

Secondly there is a lot of mistakes/syntax errors in your code. I'm not sure what IDE (editor) you are using but please consider adding a jshint plugin (you could also run it through an online jshint @ http://jshint.com/) or something similar to your IDE if possible. It will point out mistakes in your code. Some mistakes in your code is:

  • Missing a lot of semicolons in scope variables and functions (this will lead to JavaScript to not know where to go next etc)
  • Using bad javascript operators like resp.data.errors.email != undefined which should be resp.data.errors.email !== undefined

This is also really bad:

moment($scope.iosDate.value.toISOString()).hour(7).minute(0).toISOString(),
         moment($scope.iosDate.value.toISOString()).hour(8).minute(0).toISOString(), 
         moment($scope.iosDate.value.toISOString()).hour(9).minute(0).toISOString(),
          moment($scope.iosDate.value.toISOString()).hour(10).minute(0).toISOString(),
           moment($scope.iosDate.value.toISOString()).hour(11).minute(0).toISOString(),
            moment($scope.iosDate.value.toISOString()).hour(12).minute(0).toISOString(),
             moment($scope.iosDate.value.toISOString()).hour(13).minute(0).toISOString(),
              moment($scope.iosDate.value.toISOString()).hour(14).minute(0).toISOString(),
               moment($scope.iosDate.value.toISOString()).hour(15).minute(0).toISOString(), 
               moment($scope.iosDate.value.toISOString()).hour(16).minute(0).toISOString(),
                moment($scope.iosDate.value.toISOString()).hour(17).minute(0).toISOString(),
                 moment($scope.iosDate.value.toISOString()).hour(18).minute(0).toISOString(),
                  moment($scope.iosDate.value.toISOString()).hour(19).minute(0).toISOString(),
                   moment($scope.iosDate.value.toISOString()).hour(20).minute(0).toISOString(),
                    moment($scope.iosDate.value.toISOString()).hour(21).minute(0).toISOString(),
                     moment($scope.iosDate.value.toISOString()).hour(22).minute(0).toISOString()

I would imagine you can do this some other way.

Also check your resource files size. For example if you are using background images, icons or similar, check that they are not overly huge.

These are the first thoughts that came up to my mind when looking at your code. Please try these first (at least correct the errors in the code) and let me know if it's any help to your problem.

like image 125
thepio Avatar answered Nov 17 '22 16:11

thepio