Cordova Ionic - App意外停止了

Kar*_*han 9 android cordova ionic-framework

Ardoid应用程序意外停止.

控制器文件的链接是:https://www.dropbox.com/s/d0lc34q3mzlgfkj/controllers.js?dl = 0

我将OSX更新为El capitan后出现问题.在更新之前,应用程序将在模拟器中完美启动.现在,即使我构建了APK并尝试将其安装在手机上,也无法安装.

下面是我的日志文件的图像:

在此输入图像描述

我究竟做错了什么?

the*_*pio 3

好的,我发现很多事情可能会导致你遇到这个问题。

首先,请考虑使用$stateProvider来声明您的状态并设置每个状态的控制器,这样它们就不会在运行应用程序时同时加载所有内容(不确定您是否刚刚将所有代码设置到一个文件中以向我们展示什么)你有)。但你知道在你的角度配置集中:

使用示例$stateProvider

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

其次,您的代码中有很多错误/语法错误。我不确定您使用的是什么 IDE(编辑器),但请考虑添加 jshint 插件(您也可以通过在线 jshint @ http://jshint.com/运行它)或如果可能的话与您的 IDE 类似的东西。它会指出你的代码中的错误。您的代码中的一些错误是:

  • 作用域变量和函数中缺少大量分号(这将导致 JavaScript 不知道下一步该去哪里等)
  • 使用糟糕的 JavaScript 运算符,就像resp.data.errors.email != undefined应该这样resp.data.errors.email !== undefined

这也很糟糕:

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()
Run Code Online (Sandbox Code Playgroud)

我想你可以用其他方式做到这一点。

另请检查您的资源文件大小。例如,如果您使用背景图像、图标或类似图像,请检查它们是否太大。

这些是我在查看您的代码时首先想到的想法。请先尝试这些(至少纠正代码中的错误),然后让我知道这是否对您的问题有帮助。