Collect and Upload Crash Reports¶
To ensure that crash reports are collected and uploaded to SAP Mobile Services, you must:
- Initialize the crash reporter.
- Obtain user consent in order to be able to upload crash reports.
- Upload crash reports.
Initialize the Crash Reporter¶
SAPFioriFlows, as initialization is handled by its
Otherwise, you can initialize the crash reporter as follows:
Obtain User Consent¶
SAPFioriFlows as obtaining user consent is handled by its
Otherwise, you have to obtain user consent by yourself and can then pass the information as follows:
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.
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.