Mobile developers might often suffer from app crashes. Instana provides a crash collection and analytics process for them to detect, understand and resolve app crashes promptly. This crash analytics feature minimizes the number of affected users, reduces the negative impact of crashes and ultimately improves the user experience.
Symbolication
When an app crashes, the operating system collects diagnostic information about the app at the time of the crash. One of the most important parts of the crash report are the thread backtraces, which are reported as hexadecimal addresses. Instana translates these addresses into readable function names and line numbers in source code through a process called symbolication. Symbolication is achieved by using debug symbols.
dSYM(debug Symbol) file
When Xcode compiles your source code into machine code, it generates a list of symbols in your iOS app — class names, global variables, and method and function names. Debug symbols associate these symbols with file and line numbers where they’re defined. All debug symbols are stored in a dSYM file for each binary file in an app. With the dSYM files, the crash report can be symbolicated to show function names and line numbers instead of memory addresses.
Analyzing iOS app crashes
To collect and analyze iOS app crashes with dSYM files, complete the following steps:
1. Create a mobile app in the Instana UI:
a. Go to Websites & Mobile Apps > Mobile Apps.
b. On the Mobile Apps tab, click Add Mobile App.
c. Enter a mobile app name.
d. Record the values for Reporting Url and Key.
2. Add the Instana iOS agent as a dependency to your iOS app by using one of the following tools:
- Swift Package Manager (through Xcode)
- CocoaPods
For more information, see iOS agent installation.
3. Set up the Instana iOS agent with crash collection enabled:
a. Initialize the Instana iOS agent by calling the setup() function in your app code.
b. Set the enableCrashReporting property to true.
import UIKit
import InstanaAgent
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Instana.setup(
key: "pUGWKa8aRq6RnyJWibf-MQ",
reportingURL: URL(string: "https://instana.rocks/mobile"),
enableCrashReporting: true
)
return true
}
}
4. Build your iOS application with symbol information in Xcode:
a. Configure the Debug Information Format build setting to DWARF with dSYM File.
b. Set the Generate Debug Symbols option to Yes.
By configuring these settings, Xcode generates the related dSYM files for your app during building.
5. Release your iOS app and install the app on your iOS device.
6. Upload your compressed dSYM files to the Instana backend:
a. In the Instana UI, create a configuration to upload the dSYM file:
b. Compress your dSYM files into a .tgz file.
c. Upload the file by using the Instana web REST API.
For more information, see Uploading dSYM files.
7. Simulate an iOS app crash
a. Trigger a crash of your iOS app, such as memory access error or no disk storage.
b. Start your app again.
8. Analyze crashes in the Instana UI:
a. Go to Websites & Mobile Apps > Mobile Apps.
b. Click your mobile app.
c. On the Crashes tab, click an error message group. You can view all crash details. The details include the number of crashes, number of affected users, error messages, stack trace, and other information.
The pretty stack trace provides a symbolicated result of the crash log with following information, which helps you diagnose issues in your app more easily.
-
- Image class
- File name
- Function name
- Line number of the code in the file
- Memory address
Summary
Instana crash analytics provides deep insight into the stability and performance of mobile apps, which helps mobile developers to provide more stable products with better user experiences.
Co-Authors: