react-native-background-fetch: Background Fetch Not Working [IOS]

Your Environment

  • Plugin version: 3.0.3
  • Platform: iOS
  • OS version: 13.2.3
  • Device manufacturer / model: 11 Pro
  • React Native version (react-native -v): 0.61.5
  • Plugin config just timere 15

Expected Behavior

Work on background

Actual Behavior

When close app console says and not working on background. Can’t end BackgroundTask: no background task exists with identifier 1 (0x1), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.

Steps to Reproduce

  1. start app
  2. background Fetch config started on componentDidMount
  3. Closed app
  4. And error fired

Context

Work on background fetch

Debug logs

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 54 (21 by maintainers)

Most upvoted comments

I don’t know exactly the code packaged in this library. As I can see, when you used Debug Simulate Background Fetch event. You will receive taskId as “react-native-background-fetch”. For my understanding, this is TRADITIONAL taskId, base on this taskId whenever we call “BackgroundFetch.finish(taskId)”, the completionHandler from delegate “performFetchWithCompletionHandler” should be called to complete TRADITIONAL background fetch task.

about taskId “com.transistorsoft.fetch” which is required in the setup process. It is only a custom task defined and required from iOS 13+ to schedule a task.

There are 2 cases that can be a reason for your issue, that you did not receive events:

  • If you are using iOS device with OS 13+. You should schedule a custom task because TRADITIONAL callback “performFetchWithCompletionHandler” maybe not worked as expected (caused it is deprecated)
  • Otherwise, you properly only expect TRADITIONAL callback fires in this case and when it is fired belongs to USER USAGE app behavior.

BR,

I have no idea what you’re doing wrong.

In this repo is a fully functional /example app. Clone this repo and run the /example

@balwinder4264 Please edit your post and syntax-highlight your code by wrapping in triple-backticks.

Review the iOS Setup. v3 is a major refactor and iOS Setup has changed significantly.

Hello again,

already verified setup but still not work 😕