【问题标题】:Ionic is not defined in Ionic v2 Push NotificationsIonic 未在 Ionic v2 推送通知中定义
【发布时间】:2016-09-27 16:55:01
【问题描述】:

我在关注这篇文章:Ionic Push Notification Guide

但在完成所有步骤后,我的 ionic 应用程序的 app.js 的下一行中不断出现“Ionic is not defined”:

var push = new Ionic.Push({
  "debug": true
});

我不知道为什么会发生这种情况,但这是我的 angular.module.run 函数,以便更深入地了解此事:

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if (window.StatusBar) {
      StatusBar.styleDefault();
    }
    var push = new Ionic.Push({
      "debug": true
    });
    push.register(function(token) {
      console.log("My Device token:",token.token);
      push.saveToken(token);
    });
  });
})

请告诉我我可以提供的任何其他信息,以使这个问题更清楚。

【问题讨论】:

    标签: angularjs ionic-framework push-notification ionic2


    【解决方案1】:

    试试这个:

    在后面加上下面一行

    <script src="lib/ionic/ionic.bundle.js"></script>
    

    在您的 index.html 文件中。

    <script src="lib/ionic-platform-web-client/dist/ionic.io.bundle.js"></script>
    

    并使用此命令:ionic config set dev_push true

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-04
      • 1970-01-01
      • 2020-06-25
      • 1970-01-01
      • 2015-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多