Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
MarcoEidinger
Product and Topic Expert
Product and Topic Expert

Overview


Recently released version 6.0 of SAP Cloud Platform SDK for iOS introduces support for iOS crash reporting. Gather client crash data and upload them to SAP Cloud Platform Mobile Services, where you use analytical tools to gauge the impact on business users.

In this article, I will help you to understand

  • how to allow crash log upload in Mobile Services

  • how to collect and upload crash logs with the SDK

  • how to upload dSYM files in Mobile Services

  • how to analyze and drill down on crash information in Mobile Services


I assume you already have basic knowledge about SAP Cloud Platform Mobile Services and have access to an account. If not you can get more details and instructions about how to request a trial version in this tutorial.

Important: iOS crash reporting is only available in SAP Cloud Platform, Cloud Foundry environment!

Step 1: Allow crash log upload in Mobile Services


For existing apps, please enable Crash Log Upload in the assigned feature Mobile Client Usage and User Feedback.

Using the latest SAP Cloud Platform SDK for iOS Assistant to create a project will automatically enable it

Step 2: Collect and upload crash logs with the SDK


Initialize crash reporter


It is recommended to use SAPFioriFlows framework as initialization is handled by its DataCollectionConsentStep

In case you created your project with an older SDK version then simply replace the old UsageCollectionConsentStep with the new DataCollectionConsentStep.

Otherwise, you can initialize the crash reporter as follows:
import SAPFoundation

SAPCrashReporter.shared.initialiseCrashReporter()

Obtain user consent


It is recommended to use SAPFioriFlows framework as s obtaining user consent is handled by its DataCollectionConsentStep

In case you created your project with an older SDK version then simply replace the old UsageCollectionConsentStep with the new DataCollectionConsentStep. The new step handles user consent for usage collection + crash reporting.

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 report


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.

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.
extension AppDelegate {
private func uploadCrashReport() {
guard let session = self.sessionManager.onboardingSession else {
// Onboarding not yet performed
return
}
guard let settingsParameters = session.settingsParameters else {
return
}
// Upload crash logs after onboarding
SAPCrashReporter.shared.uploadCrashFile(sapURLSession: session.sapURLSession,
 settingsParameters: settingsParameters)
}
}

For existing projects, you can easily copy and paste the extension. Please make sure to call uploadCrashReport() after the user successfully onboarded.

Step 3: Upload dSYM files in Mobile Services


You might wonder why the iOS crash reports might show the memory address related to a stacktrace frame rather than the source code location.

When Xcode compiles your source code into machine code, it generates a list of symbols in your app—class names, global variables, and method and function names. These symbols correspond to the file and line numbers where they’re defined.

By default, the debug symbols are stripped when compiling a release build to reduce the size of the generated binary. Those debug symbols carry the required information to translate from a memory address to the associated source file and line number.

You need to upload your app-specific dSYM file to SAP Cloud Platform Mobile Services. If you are using 3rd party frameworks then you should also upload those dSYM files for proper symbolication.

Select the Symbol Center tab in assigned feature Mobile Client Usage and User Feedback which provides on-screen information on how to find missing symbols on your machine. Compress the dSYM file(as) as zip archives and upload them.

Good news: dSYM files for SAP Cloud Platform SDK for iOS frameworks do not need to be uploaded. They are already known to SAP Cloud Platform Mobile Services.

Step 4: Analyze crash information in Mobile Services


SAP Cloud Platform Mobile Services performs an intelligent grouping of individual crashes (with the same root cause) across devices, users, and versions.

You can view and filter for crash groups by

  • platforms

  • apps

  • versions and

  • timeframe


Charts give you a graphical representation of

  • crashes over time

  • affected users over time


For a crash group, you see the common stack trace but you are also able to drill-down to the individual crash reports to view device-specific information.


Video


The video illustrates steps 3 and 4 in the SAP Cloud Platform Mobiel Services cockpit.

Summary


With this information and the SDK Version 6.0.0 (download via Developer Trials & Download page) , you are equipped to collect and upload crash reports for analysis in Mobile Services.

Please leave a question if something is not unclear.

Please like the blog post if you found the information helpful.

Appendix


10 Comments