javascript - React-Native:应用程序关闭时后台应用程序刷新

标签 javascript objective-c swift react-native objective-c-swift-bridge

我需要每 30 或 60 分钟更新一次应用程序的数据库。经过大量搜索,我找到了这个模块:

https://github.com/transistorsoft/react-native-background-fetch

正如其页面中所说:

iOS Background Fetch is basically an API which wakes up your app about every 15 minutes (during the user's prime-time hours) and provides your app exactly 30s of background running-time. This plugin will execute your provided callbackFn whenever a background-fetch event occurs. There is no way to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible value of UIApplicationBackgroundFetchIntervalMinimum -- iOS determines the rate automatically based upon device usage and time-of-day (ie: fetch-rate is about ~15min during prime-time hours; less frequently when the user is presumed to be sleeping, at 3am for example).

如果我用 swift 写一些代码会怎样?我在 react native 中使用 sqlite 来存储我的数据。如果我在 swift 中编写一些代码来唤醒并检查新数据,我可以访问我用来在 React Native 中存储数据的同一个数据库吗?

我正在使用 react-native-sqlite-storage 将我的数据存储在 react native 中。

https://github.com/andpor/react-native-sqlite-storage

最佳答案

如果你在同一个应用程序下运行后台任务,你可以访问你用来存储在 react native 中的数据库

关于javascript - React-Native:应用程序关闭时后台应用程序刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40068893/

相关文章:

javascript - 针对全局窗口的多个 Sinon stub 未按预期工作

javascript - ExtJS 4.2 - 图表重绘,仍然看到旧标签

objective-c - 如何使用 xib 文件正确实现 NSWindowController 子类

objective-c - 当我禁用按钮时,有没有办法防止文本变成灰色?

ios - 通用 Swift 结构 : Segmentation fault: 11

ios - 如何在 Localized.strings 中添加基本本地化文件

ios - 使用 Swift 进行视频缓冲输出

javascript - JS ProgressEvent 仅在完成时触发

javascript - 如何在 Meteor 中执行响应式(Reactive)外部 API 调用?

ios - 使用 NSNotification 作为 if 参数