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.
- Run the following commands in the project and run it in the expo client in app store.
yarn && yarn start
- 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
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:
- Created 3 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
With SDK38 I don’t have this issue anymore and the background task is working as expected.
@tsapeta - probably worth investigating after sdk 38 release