在手机上运行Ember Cordova应用程序时,出现错误 - 无法读取未定义的属性“通知”

时间:2017-09-26 07:18:39

标签: javascript android cordova ember.js npm

安装了cordova-plugin-local-notifications并重试了它。 发生错误的代码行 -

cordova.plugins.notification.local.on("click", function (notification) {

错误: -

  

处理路径时出错:仪表板无法读取属性   未定义TypeError的'notification':无法读取属性   未定义的“通知”

在评论该行时,我的下一行有另一个错误

states[Connection.UNKNOWN] = 'Unknown connection';

再次给出错误,说连接不存在。我假设有一些cordova包或依赖缺失。但是在另一个应用程序的application.js上运行相同的代码行,没有给出这样的错误。当比较有效的应用程序和没有使用的应用程序时,没有任何与cordova和bower文件中缺少的cordova相关的信息。

Also in this case, cordova didn't have the function plugin. But the other app that had the same packages and lines of code in application.js, had plugin  in cordova object.

1 个答案:

答案 0 :(得分:0)

cordova / config.xml中缺少

插件

<widget id="com.company.app" version="1.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
...
<plugin name="de.appplant.cordova.plugin.local-notification" spec="https://github.com/katzer/cordova-plugin-local-notifications" />
...
</widget

这解决了重建问题。