调用函数更新 App 时,Ionic Force App Update 崩溃
Ionic Force App Update crashes when calling the function to update the App
我有一个 Ionic 3 应用程序,需要对 应用程序[=]的所有用户使用强制更新 51=]。我使用了这个名为 Ionic App Update 的包。我创建了一个 small express server,它将只为 client 提供更新。
这是我在 update.xml 中 server 或 backend 中的代码]
<update>
<version>0.0.2</version>
<name>MyApp</name>
<url>http://192.168.214.27:3346/public/android-debug.apk</url>
</update>
在我的 server.js
const express = require('express')
const app = express()
app.use('/public', express.static('public'))
app.get('/', (req, res) => {
shell.exec('./update.sh')
})
app.listen(3336, () => {})
服务器工作正常没有错误
但是当我尝试调用 App 更新插件的函数时,设备每次都会崩溃。
这是我的 app.component.ts
中的代码
constructor() {
this.update()
}
update() {
console.log('Update check')
const updateUrl = 'http://192.168.214.27:3346/public/update.xml';
this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') }).catch(err => {
console.log(err)
console.log('No update')
});
}
每次应用程序组件构造函数初始化时,我都会调用 update 函数。
但是当我调用函数时,应用程序崩溃
这更多是 android 版本 问题还是什么?
如果有人能提供帮助,我们将不胜感激。
提前致谢。
这一行 <version>0.0.2</version>
似乎是问题所在。这不是 android 版本号的格式。根据 cordova 的文档,它是
Expressed in major/minor/patch notation.
例如版本 30.20.48 将写为 302048。
阅读更多:
config.xml - https://cordova.apache.org/docs/en/latest/config_ref/
Android 平台指南 - https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#setting-the-version-code
我有一个 Ionic 3 应用程序,需要对 应用程序[=]的所有用户使用强制更新 51=]。我使用了这个名为 Ionic App Update 的包。我创建了一个 small express server,它将只为 client 提供更新。
这是我在 update.xml 中 server 或 backend 中的代码]
<update>
<version>0.0.2</version>
<name>MyApp</name>
<url>http://192.168.214.27:3346/public/android-debug.apk</url>
</update>
在我的 server.js
const express = require('express')
const app = express()
app.use('/public', express.static('public'))
app.get('/', (req, res) => {
shell.exec('./update.sh')
})
app.listen(3336, () => {})
服务器工作正常没有错误
但是当我尝试调用 App 更新插件的函数时,设备每次都会崩溃。
这是我的 app.component.ts
中的代码constructor() {
this.update()
}
update() {
console.log('Update check')
const updateUrl = 'http://192.168.214.27:3346/public/update.xml';
this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') }).catch(err => {
console.log(err)
console.log('No update')
});
}
每次应用程序组件构造函数初始化时,我都会调用 update 函数。
但是当我调用函数时,应用程序崩溃
这更多是 android 版本 问题还是什么?
如果有人能提供帮助,我们将不胜感激。 提前致谢。
这一行 <version>0.0.2</version>
似乎是问题所在。这不是 android 版本号的格式。根据 cordova 的文档,它是
Expressed in major/minor/patch notation.
例如版本 30.20.48 将写为 302048。
阅读更多: config.xml - https://cordova.apache.org/docs/en/latest/config_ref/ Android 平台指南 - https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#setting-the-version-code