Ionic 3 - 如何获取应用程序版本号?
Ionic 3 - How to get application version number?
我正在使用应用版本插件来获取版本号。我正在尝试如下:plugin
this.appVersion.getVersionNumber().then((res)=>{
console.log(res);
}, (err)=>{
console.log(err);
});
我遇到错误:
class not found
有没有人遇到过同样的问题,或者有没有其他方法可以获取版本号?
import { AppVersion } from '@ionic-native/app-version';
export class appVersion {
public version;
constructor(private appVersion: AppVersion) {
.
.
this.version = this.appVersion.getVersionNumber();
}
}
使用 getVersionNumber 函数可以获取版本。
注意:App版插件不适用于浏览器环境。
我忘记添加设备就绪事件。所以最后我添加了设备事件,现在它在 android 和 ios.
中完美运行
this.platform.ready().then(()=> {
this.appVersion.getVersionNumber().then((res)=>{
console.log(res);
}, (err)=>{
console.log(err);
});
});
我正在使用应用版本插件来获取版本号。我正在尝试如下:plugin
this.appVersion.getVersionNumber().then((res)=>{
console.log(res);
}, (err)=>{
console.log(err);
});
我遇到错误:
class not found
有没有人遇到过同样的问题,或者有没有其他方法可以获取版本号?
import { AppVersion } from '@ionic-native/app-version';
export class appVersion {
public version;
constructor(private appVersion: AppVersion) {
.
.
this.version = this.appVersion.getVersionNumber();
}
}
使用 getVersionNumber 函数可以获取版本。
注意:App版插件不适用于浏览器环境。
我忘记添加设备就绪事件。所以最后我添加了设备事件,现在它在 android 和 ios.
中完美运行this.platform.ready().then(()=> {
this.appVersion.getVersionNumber().then((res)=>{
console.log(res);
}, (err)=>{
console.log(err);
});
});