Skip to main content

Test it

Let's crash your app to see what the crash report looks like on your Shake dashboard.

You're viewing the iOS docs. Other platform →   Android 

note

Before proceeding, disconnect your device from the Xcode debugger. Xcode debugger attaches itself to the app process and would disable crash reporting.

Crash your app​

Enable crash reporting and paste this code to the viewDidLoad method in one of your view controllers. It will crash your app when you tap a button by accessing the array with the out-of-bounds index:

ViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
let crashButton = UIButton(type: .roundedRect)
crashButton.setTitle("Crash me", for: .normal)
crashButton.frame = .init(x: 0, y: 0, width: 100, height: 50)
crashButton.center = self.view.center
self.view.addSubview(crashButton)
crashButton.addTarget(self, action: #selector(crashButtonHandler), for: .touchUpInside)
}
@objc func crashButtonHandler() {
let arr = [1, 2, 3]
let myVar = arr[5]
}

Reopen your app, describe the crash and tap Submit.

Visit your Shake dashboard​

To see your crash report:

  1. Visit your Shake dashboard
  2. Switch to the Crash reports tab in the left sidebar

If your crash report is not visible instantly, wait a minute until the system processes it.