How to implement Exception/Error Handling in Swift 4 with native Crash Reporting?

As you told in question that, iTunes is providing only number of crashes, but does not provide crash information.

In reality, XCode itself provides you full fledged detail of crash with line number, device information, build detail etc all things.

HereIn, I am describing how you can get detail of crashes from Xcode

  1. Go to 'Window' -> 'Organizer' in xcode

enter image description here

  1. New window get opened, select your app name from left sided list of apps, and select Crashes from top segment control.

enter image description here

  1. Now, You can select the version that you want(Even you can select the Beta build that you uploaded on testflight), once you select version, you will get all the crashes of that version. You can see in below image that, it shows details of device, details of thread etc.

enter image description here

  1. Now, if you want to go to the line, where crash happened. Just hover at bold line in crash detail, you will see arrow button as in below image. Once you click that button, Xcode will redirect you to related line in your project.

enter image description here

I think, it is now clear to you, about how to see the crashes from the live app.


Yes for that you have to make your custom crash report manager and you can use NSSetUncaughtExceptionHandler for getting the crash report stack.

Example

NSSetUncaughtExceptionHandler { exception in

    print(exception)
    print(exception.callStackSymbols)

    // Write callStackSymbols into the file
    // Call your mail function with that file
    // mail()
}

let array = NSArray()
let element = array.object(at: 4)

You can write that Crash Report into the file and mail it.