【问题标题】:cordova-hot-code-push-plugin removing other installed ionic cordova native pluginscordova-hot-code-push-plugin 删除其他已安装的 ionic cordova 本机插件
【发布时间】:2019-01-26 05:07:26
【问题描述】:

我正在开发一个 ionic cordova 应用程序,并且我正在使用 cordova-hot-code-push-plugin。热代码推送插件完美地从服务器获取更新并安装它。安装后,我注意到其他离子原生插件(如 Camera、File 等)无法正常工作,当我注意到 cordova_plugin.js 文件时,文件中缺少插件。

这是我的 app.component.ts

private hotCordovaPushOptions:HotCodePushRequestOptions = {
    "config- file":"https://warehousemobile.000webhostapp.com/warehouse/chcp.json",
};

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,private hotCodePush:HotCodePush) {
platform.ready().then(() => {
  // Okay, so the platform is ready and our plugins are available.
  // Here you can do any higher level native things you might need.
  statusBar.styleDefault();
  splashScreen.hide();
  this.hotCodePush.fetchUpdate(this.hotCordovaPushOptions).
  then(
      (value:any)=>{
                  this.hotCodePush.isUpdateAvailableForInstallation().
                  then((value:HotCodePushUpdate)=>{
                        this.hotCodePush.installUpdate().then((res:any)=>{
                          console.log(res);
                          }
                        )
                  })

      },(error:any)=>
      {
        console.log("e =>"+error)
      });
});

}

这是我的cordova-hcp.json

{
   "name": "hot-code-push",
   "ios_identifier": "",
   "android_identifier": "",
   "update": "start",
   "content_url": "https://warehousemobile.000webhostapp.com/warehouse"
}

在获取更新之前,cordova_plugin.js

module.exports.metadata = 
  // TOP OF METADATA
  {
     "cordova-plugin-camera": "4.0.3",
     "cordova-plugin-whitelist": "1.3.3",
     "cordova-plugin-splashscreen": "5.0.2",
     "cordova-plugin-ionic-webview": "2.0.3",
     "cordova-plugin-ionic-keyboard": "2.1.2",
     "cordova-hot-code-push-plugin": "1.5.3"
   };

获取更新后

  module.exports.metadata = 
   // TOP OF METADATA
    {
        "cordova-plugin-device": "2.0.2",
        "cordova-plugin-splashscreen": "5.0.2",
        "cordova-plugin-ionic-webview": "2.0.3",
        "cordova-plugin-ionic-keyboard": "2.1.2",
        "cordova-hot-code-push-plugin": "1.5.3"
   };

【问题讨论】:

    标签: cordova ionic-framework cordova-plugins ionic-native


    【解决方案1】:

    问题在于 ionic 团队最近发布的 WKWebView 插件,它不适用于 Cordova 热代码推送插件。使用命令删除插件

    ionic cordova plugin remove cordova-plugin-ionic-webview --save
    

    并添加以下插件

    cordova plugin add cordova-plugin-wkwebview-engine
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-02
      • 2017-01-14
      • 2019-05-14
      • 2018-08-12
      • 1970-01-01
      • 2020-04-22
      • 2018-04-05
      • 2019-03-05
      相关资源
      最近更新 更多