High traffic iOS apps likely to experience crashes when users are using them. The crash is the process in which app gets killed itself and become unusable. The crash may be intermittent or reproducible, if the crash happens at the key user journey then the business is likely to lose revenue. Therefore, it’s very important to keep track of the crashes happening in the app. At the moment most of the companies use third-party tools like Crashlytics, or similar. Most of the iOS team are not aware of the fact that crash reports are available from the Xcode itself. In this short post, we will see how to access the crash reports from Xcode.
Root Cause Of Crashes
Everybody hates the crashing app for sure, however, it’s interesting to find out what causes the crash in the app. Nobody intentionally injects crashes in the app, there are various factors can cause the crash in the iOS app. Some of the most common reasons are
- Coding Error
The most common cause of the crash is the developers unintentionally code the crash in the app. In Swift, you might have seen the use/misuse of forced unwrapping feature caused some crashes. As Swift is type-safe programming languages and prevents the crashes from using some great features like conditional binding or optional binding. Sometimes programming language tries to prevent the failure or another time developer tries to prevent the failure which results in crashes.
- Operating System Policy
An iOS operating enforce some policies, some times it’s hard for the CPU to execute the code, As a result of this app crashes. Some of the policies that applied for the lower version of the iOS cannot be applied for the newer version of the operating systems.
When an iOS app crashes, then the crash report generated on the device. Crash reports play a very important role to understand the root cause of the crash. Most of the times, when you see the crash reports, usually those reports are not readable and full of machine code and memory locations. Symbolication is the process of turning the crash reports into the human-readable format. The crash reports are generated in the form of the .crash file. If the crash reports are not symbolicated, it’s hard to understand. You can read the process of the symbolication in more details here. In order to fix any crash, it’s important to get the information out from the crash report. An entire process of analysing the crash reports is out of the scope of this post. However, you can find detailed information on the official Apple documentation here.
Getting Crash Reports in Xcode
Since Xcode 10, crash and energy reports are available in the Xcode organiser itself so you don’t have to rely on any third-party tools to access the reports. In order to get access to the Crash reports in Xcode, you should be
- Sign into the Xcode with your Apple developer account
- Upload an app with debug symbol or DSYMs
- In Xcode, open Windows->Organizer, you will see another window with information of all the apps uploaded to App Store or TestFlight
- From the organizer, you can access all the archive, crash and energy reports of the apps.
The Xcode organizer window will look like this
You can toggle between crash organiser and energy organizer to see the different reports.
The crash organizer will show all the information about the crashes in the last two weeks. The information contains
- Crash reports for all the apps uploaded for the TestFlight or App Store including the App Extensions.
- A crash report will highlight the point of a crash and allow the developer to debug the crash in Xcode.
- Reports show the number of devices affected using a nice chart.
- The crash reports are fully symbolicated so developers don’t have to symbolicate reports themselves.
In summary, the crash reports generated by the Xcode are more user-friendly and the developer would find more useful in order to fix the crash.
How Xcode generates the Crash Reports
It would be interesting to know how Xcode gets all the information to generate crash reports. An entire process is very simple. When uploaded app from Xcode gets the crash, then the reports automatically send to the App Store. The server then symbolocate the crash reports and sends back to the Xcode organizer.
Xcode Crash Reports VS Crashlytics
There are various tools available for generating the crash reports, one of the popular tools is Crashlytics. The key feature Crashlytics provide is the Dashboard which can be used by the non-technical people. On another hand, Xcode crash reporting is developer friendly. The developer responsible for fixing the crashes can benefit from the Xcode crash reports.
Xcode has some great features that are less known to the developers, the crash organizer is one of them. It would be great if iOS developers start using these feature to fix the crashes as soon as possible. If you are not using the crash organiser features, enable it today and check out the crash logs for your existing apps. Hope you will find something useful there.