cordova-hot-code-push-plugin 删除其他已安装的 ionic cordova 本机插件
cordova-hot-code-push-plugin removing other installed ionic cordova native plugins
我正在开发一个 ionic cordova 应用程序,我正在使用 cordova-hot-code-push-plugin。热代码推送插件完美地从服务器获取更新并安装它。安装后,我注意到其他离子原生插件(如相机、文件等)无法正常工作,当我注意到 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"
};
问题出在ionic团队最近发布的WKWebView插件上,它与Cordova热代码推送插件不能很好地兼容。使用命令
删除插件
ionic cordova plugin remove cordova-plugin-ionic-webview --save
并添加以下插件
cordova plugin add cordova-plugin-wkwebview-engine
希望对您有所帮助
我正在开发一个 ionic cordova 应用程序,我正在使用 cordova-hot-code-push-plugin。热代码推送插件完美地从服务器获取更新并安装它。安装后,我注意到其他离子原生插件(如相机、文件等)无法正常工作,当我注意到 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"
};
问题出在ionic团队最近发布的WKWebView插件上,它与Cordova热代码推送插件不能很好地兼容。使用命令
删除插件ionic cordova plugin remove cordova-plugin-ionic-webview --save
并添加以下插件
cordova plugin add cordova-plugin-wkwebview-engine
希望对您有所帮助