Skip to content

Collect and Upload Crash Reports

To ensure that crash reports are collected and uploaded to SAP Cloud Platform 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

SAPCrashReporter.shared.initialiseCrashReporter()

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 Cloud Platform Mobile Services will have then been fully established.

import SAPFoundation

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

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

Important

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


Last update: November 6, 2020