SwiftData with CloudKit Error: Error updating background task request

Hi,

Overview

  • I have a SwiftData project which automatically syncs with CloudKit.
  • When I run the app, I see the following error in Xcode logs.
Error updating background task request: Error Domain=BGSystemTaskSchedulerErrorDomain Code=3 "(null)"

My attempt

I can enable Background processing (under Signing & Capabilities > Background modes), but I don't know the BGTaskSchedulerPermittedIdentifiers to add in the Info.plist

Questions

  1. How can I resolve this?
  2. If I should enable background processing, what are the BGTaskSchedulerPermittedIdentifiers to add in Info.plist?
Answered by DTS Engineer in 888297022

A similar question was discussed here. The error code is different (3 vs. 8), but the technical nature is pretty much the same:

  • The error was triggered by the framework, and is not something that can be fixed from the app side.
  • SwiftData + CloudKit creates a new task when it detects that the previous task failed, or that there is unsynchronized data, which can eventually get the data synchronized.

So in case your app data is synchronized, you can ignore the error.

If your app doesn’t synchronize data at all, that will be a coding level issue on your side, and you can follow TN3164 and TN3163 to debug the issue.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

@DTS Engineer They had asked me to close the bug as it was a duplicate of FB22670054. So I have closed FB22670187

@newwbee This occurs solely to prevent duplication, as my request is to avoid submitting the same bug. Thanks

Albert
  Worldwide Developer Relations.

Accepted Answer

A similar question was discussed here. The error code is different (3 vs. 8), but the technical nature is pretty much the same:

  • The error was triggered by the framework, and is not something that can be fixed from the app side.
  • SwiftData + CloudKit creates a new task when it detects that the previous task failed, or that there is unsynchronized data, which can eventually get the data synchronized.

So in case your app data is synchronized, you can ignore the error.

If your app doesn’t synchronize data at all, that will be a coding level issue on your side, and you can follow TN3164 and TN3163 to debug the issue.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

SwiftData with CloudKit Error: Error updating background task request
 
 
Q