Configure background tasks

We utilize background tasks to send you a usage report when a user doesn't use your application at the moment. This allows us to ensure that usage tracking is delivered to our servers.

To send network requests with usage reports in the background, you must select the Background fetch checkbox in the Background modes capability group.

  1. Go to the Signing & Capabilities tab.
  2. Add Background modes capability.
  3. Select Background fetch mode.
  4. Select Background processing mode.

Add the following code to your UIApplicationDelegate class:

func application(
  _ application: UIApplication,
  handleEventsForBackgroundURLSession identifier: String,
  completionHandler: @escaping () -> Void
)
{
  if SetappManager.isSetappBackgroundSessionIdentifier(identifier) {
    SetappManager.shared.backgroundSessionCompletionHandler = completionHandler
  }
}

Permitted background task identifiers

For iOS 13 and later, we also utilize background tasks. That means that you must allow Setapp to run background tasks with specific identifiers. To do that:

  1. Open your Info.plist file.
  2. Add the Permitted background task scheduler identifiers (BGTaskSchedulerPermittedIdentifiers) key to the dictionary.
  3. Append com.setapp.usageReport to the key values array.