Fixing The Introvert Crash

This has happened with almost all of the iOS developers out there. We do see some crashes that did happen outside the ‘my code’ area, like the CFNetwork.

When this happens, project lead often pops up a question, “How much is the count?”, and without listening, this might come up, “Are we still 99.5% crash free?”
“Yes? We can ignore it then. Lets focus on the tickets.”

The worst part of these crashes is that, we do not know, why this happened and most importantly where did it happen. We are just blank. The stack trace show nothing thats relevant to track them.

I had often neglected such crashes in my earlier developer days. But I think, we should at least know the point of origin of such crashes. Maybe this would help us track down the crash, or if not, then, at least we can know the severity of this, by understating that this did not popped up in the applications major flow.
So, this is how we track such crashes in our system. Using,
Custom keys help you get the specific state of your app leading up to a crash. You can associate arbitrary key/value pairs with your crash reports, viewable right from the Fabric dashboard.
It’s often useful to have some context recorded about the events leading up to a crash. Crashlytics provides logging facilities to make this easy. These messages are associated with your crash data and are visible in the Fabric dashboard if you look at the specific crash.
We save a key like
Crashlytics.sharedInstance().setObjectValue(“value”, forKey:”key” )And log like
CLSLogv(“Logging- %@, %@“,getVaList([“LogA”,”LogB”]))We can use these to add more detail to the crashes.
In our system, we have a parent UIViewController called CrashTrackerController, from which most of our view controllers are subclassed. From this single point we log and save the custom keys
And afterwards, when such a crash occurs, we get the desired details, upfront in the keys

And this is how one of the logs look like

This really works well for us. Now we know the controller where this crash occurred and by looking at the logs, we get to know the most recent flow that generated the crash.
