如何在Ionic框架中使用“代码推送插件”?

时间:2019-04-22 20:09:58

标签: ionic-framework code-push

我的离子项目运行正常。当我在项目中添加“ codepush”插件时,出现以下错误。

Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at CodePush.sync (http://localhost:8100/build/vendor.js:84063:148)
    at http://localhost:8100/build/main.js:1586:28
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
    at Object.onInvoke (http://localhost:8100/build/vendor.js:5445:33)
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
    at r.run (http://localhost:8100/build/polyfills.js:3:10143)
    at http://localhost:8100/build/polyfills.js:3:20242
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15660)
    at Object.onInvokeTask (http://localhost:8100/build/vendor.js:5436:33)
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15581)
    at c (http://localhost:8100/build/polyfills.js:3:19752)
    at http://localhost:8100/build/polyfills.js:3:20273
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15660)
    at Object.onInvokeTask (http://localhost:8100/build/vendor.js:5436:33)
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15581)
    at r.runTask (http://localhost:8100/build/polyfills.js:3:10834)
    at o (http://localhost:8100/build/polyfills.js:3:7894)
    at e.invokeTask [as invoke] (http://localhost:8100/build/polyfills.js:3:16823)
    at p (http://localhost:8100/build/polyfills.js:2:27648)
    at HTMLDocument.v (http://localhost:8100/build/polyfills.js:2:27893)

我所有的代码:

import { CodePush } from '@ionic-native/code-push/ngx';

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,private codepush:CodePush) {
    platform.ready().then(() => {
      statusBar.styleDefault();
      splashScreen.hide();
      this.codepush.sync();
    });
  }

0 个答案:

没有答案