首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Background-Fetch:无法读取未定义的属性'configure‘

Background-Fetch:无法读取未定义的属性'configure‘
EN

Stack Overflow用户
提问于 2019-04-25 04:30:52
回答 1查看 515关注 0票数 1

我一直在尝试集成晶体管软件后台抓取库,但没有成功:https://github.com/transistorsoft/react-native-background-fetch

当我将任何方法链接到BackgroundFetch组件时,我得到错误(附在这篇文章中)

代码语言:javascript
复制
import BackgroundFetch from "react-native-background-fetch";

class TimerScreen extends React.Component {

...

componentDidMount() {

    this.configureBackgroundFetch();

}
...
configureBackgroundFetch() {
    // Configure BackgroundFetch.
    BackgroundFetch.configure({
      minimumFetchInterval: 15, // <-- minutes (15 is minimum allowed)
      stopOnTerminate: false, // <-- Android-only,
      startOnBoot: true, // <-- Android-only
      enableHeadless: true
    }, async () => {
      console.log('BackgroundFetch has started');
      BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA);
    }, (error) => {
      console.log('RNBackgroundFetch failed to start')
    });
}
...

我还不能找出库不能工作的原因。我使用了react原生链接,并将其安装在package.json中

代码语言:javascript
复制
 ...
 {
       ...
       "react-native-background-fetch": "^2.5.3",
       ...
 }
 ...
EN

回答 1

Stack Overflow用户

发布于 2019-05-03 22:42:17

该问题是由于未正确配置Expokit以使用本机模块造成的。我制作了一个简单的React Native应用程序,这个库可以正常工作而不会返回错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55838106

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档