【发布时间】:2019-04-13 03:50:58
【问题描述】:
我正在使用 Ionic 应用程序的 cordova-plugin-background-mode 插件在后台运行我的应用程序并执行一些任务。
我已经在 Android 上实现了这一点,并且运行良好。
但是在 IOS 上,我无法使用后台模式,因为它为我的应用程序提供了 30 秒的后台运行时间,并在此之后终止了应用程序。为此,我使用cordova-plugin-background-fetch 插件。
问题是它说
初始化后台获取时出错 - “plugin_not_installed”
但是'ionic plugin add'说已经安装了..
我的代码:
const config: BackgroundFetchConfig = {
stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
};
backgroundFetch.configure(config)
.then(() => {
console.log('Background Fetch initialized');
this.backgroundFetch.finish();
})
.catch(e => console.log('Error initializing background fetch', e))
【问题讨论】:
-
尝试重新安装应用
-
做了几次
标签: ionic-framework ionic3 cordova-plugins