question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Background fetch never runs for iOS

See original GitHub issue

🐛 Bug Report

Environment

Expo CLI 3.21.1 environment info: System: OS: macOS Mojave 10.14.4 Shell: 5.3 - /bin/zsh Binaries: Node: 12.17.0 - ~/.nvm/versions/node/v12.17.0/bin/node Yarn: 1.22.0 - ~/.yarn/bin/yarn npm: 6.14.4 - ~/.nvm/versions/node/v12.17.0/bin/npm IDEs: Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild npmPackages: expo: ~37.0.3 => 37.0.12 react: ~16.9.0 => 16.9.0 react-dom: ~16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4 react-native-web: ~0.11.7 => 0.11.7

Target device i’m testing with: Two different iPhone 8 with iOS 13.5

Steps to Reproduce

We have tried the project in two different ways on our devices.

  1. Run the following commands in the project and run it in the expo client in app store. yarn && yarn start
  2. Build and deploy to Apple TestFlight EXPO_DEBUG=true expo build:ios --release-channel "textbackgroundfetch"

Expected Behavior

We click on the button that says “Register BackgroundFetch task”. We want the background task to run, hopefully every 10-15 minutes.

Actual Behavior

The background task is never run. For this example we have tried on two different devices and also two different iOS versions.

We have over the last 1.5 year tried all different examples we have found for background fetch and background location but never gotten it to work. We have tried different iOS devices over this 1.5 years. If i remember correctly i think we have gotten a background task to run on Android once before not running anymore.

Reproducible Demo

This time around i got help from @brentvatne creating the example below after a discussion on the Expo Developers slack. @brentvatne got the background fetch to run after ~20 minutes on his iOS device using the App Store Expo Client.

https://github.com/brentvatne/background-fetch-example

82274043_249024273035020_2735733703278854144_n

Side note

If there is any example project out there that might get this to work for us or anyone out there that knows why it never works, please contact me, this is getting frustrating.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dameyerdavecommented, Jul 28, 2020

With SDK38 I don’t have this issue anymore and the background task is working as expected.

1reaction
brentvatnecommented, May 31, 2020

@tsapeta - probably worth investigating after sdk 38 release

Read more comments on GitHub >

github_iconTop Results From Across the Web

Background Fetch is not working in real iOS devices
I have created an iOS native app using Swift 5.0, which internally fetch data from the server using background fetch feature of iOS...
Read more >
IOS background fetch never runs - Expo SDK - Forums
I have been trying to get Background Fetch on iOS for a few weeks now but with ... Console.log never prints and the...
Read more >
iOS Background Fetch Not Working Even Though Correct ...
Here's the only way I've found to test background fetch. Edit your scheme; Select Run; Select Options; Check the "Launch due to background...
Read more >
react-native-background-fetch - npm
Background Fetch is a very simple plugin which attempts to awaken an app in the background about every 15 minutes, providing a short...
Read more >
react-native-background-fetch | Yarn - Package Manager
scheduleTask will never run as frequently as you want. The default fetch event is much more reliable and fires far more often. scheduleTask...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found