Cannot upload files in background mode when running in release mode

I have a Flutter project that uploads files in background mode, implemented as a plugin for the iOS part. It works fine in debug mode when running from Xcode, but no files are uploaded in release mode (installed via .ipa).

I implemented functions such as BGAppRefreshTask and BGProcessingTask, and configured BGTaskSchedulerErrorCodeNotPermitted properly in Info.plist.

I registered background tasks (processing and fetch), and BGTaskScheduler also works well. The issue is that it works fine in debug mode but not in release mode.

Do I need to modify some settings in the .entitlements file or configure something else?

Environment:

macOS: Sequoia 15.7.7

Xcode: 26.3

Flutter SDK: 3.19.5

Answered by DTS Engineer in 898172022

You’re using third-party tools, and I can’t help you with those. You might have more luck asking this via the support channel for those tools. However, I can talk about this issue generally.

There are a number of different ways you can implement background uploads, the most common being:

  • A URLSession background task, which allows your app to suspend while the uploads are in progress
  • A standard URLSession using some mechanism to prevent the app from suspended

Both of these are affected by the debugger, so you’ll need to take that into account. Testing Background Session Code talks about this in the background session case.

An app refresh task is not really a good option for uploads. See iOS Background Execution Limits for more details about that.

Finally, you need to understand the difference between your build configurations (Debug and Release) and your code signing (Development and Distribution). Isolating Code Signing Problems from Build Problems talks about this in depth. It also explains how to run a Release build configuration with Development code signing, and vice versa, which are key tests for determining whether you have a build configuration or a code signing problem.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

BGTaskSchedulerPermittedIdentifiers in info.plist

a

You’re using third-party tools, and I can’t help you with those. You might have more luck asking this via the support channel for those tools. However, I can talk about this issue generally.

There are a number of different ways you can implement background uploads, the most common being:

  • A URLSession background task, which allows your app to suspend while the uploads are in progress
  • A standard URLSession using some mechanism to prevent the app from suspended

Both of these are affected by the debugger, so you’ll need to take that into account. Testing Background Session Code talks about this in the background session case.

An app refresh task is not really a good option for uploads. See iOS Background Execution Limits for more details about that.

Finally, you need to understand the difference between your build configurations (Debug and Release) and your code signing (Development and Distribution). Isolating Code Signing Problems from Build Problems talks about this in depth. It also explains how to run a Release build configuration with Development code signing, and vice versa, which are key tests for determining whether you have a build configuration or a code signing problem.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Cannot upload files in background mode when running in release mode
 
 
Q