Skip to content

Collect and Upload Crash Reports

To ensure that crash reports are collected and uploaded to SAP Mobile Services, you must:

  1. Initialize the crash reporter.
  2. Obtain user consent in order to be able to upload crash reports.
  3. Upload crash reports.

Initialize the Crash Reporter

Use SAPFioriFlows, as initialization is handled by its DataCollectionConsentStep.

Otherwise, you can initialize the crash reporter as follows:

import SAPFoundation


Use SAPFioriFlows as obtaining user consent is handled by its DataCollectionConsentStep.

Otherwise, you have to obtain user consent by yourself and can then pass the information as follows:

import SAPCommon

let userID: UUID!

CrashConsent.shared.consentForUser(userID, given: true)

CrashConsent allows you to check and revoke consent based on the given UUID.

Obtaining user consent is needed only once, normally during onboarding a new user. The information is stored on the device for subsequent sessions.

Upload Crash Reports

The app should trigger crash upload after onboarding has been successfully completed because communication to SAP Mobile Services will have then been fully established.

import SAPFoundation

SAPCrashReporter.shared.uploadCrashFile(sapURLSession: session.sapURLSession, settingsParameters: settingsParameters)

If you use the SAP BTP SDK Assistant for iOS to create your project structure, then the necessary code and service call are generated.


No upload will be performed if user consent has not been obtained.

Last update: November 18, 2021