【问题标题】:Background Fetch plugin not working on ios后台获取插件无法在 ios 上运行
【发布时间】: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


【解决方案1】:

你必须用大写写 backgroundFetch => BackgroundFetch

我的代码:

BackgroundFetch.configure(fetchCallback, failureCallback, {
minimumFetchInterval: 15,
});

【讨论】:

    猜你喜欢
    • 2018-10-25
    • 2015-11-02
    • 2020-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多