in sampleapp-ios-swift/CrashViewController.swift [47:67]
func presentCrashAlert() {
let alert = UIAlertController(title: "The app will close",
message: "A crash report will be sent when you reopen the app.",
preferredStyle: UIAlertController.Style.alert)
// Cancel Button
alert.addAction(UIAlertAction(title: "Cancel",
style: UIAlertAction.Style.default,
handler: { _ in alert.dismiss(animated: true)
}))
// Crash App button
alert.addAction(UIAlertAction(title: "Crash app",
style: UIAlertAction.Style.destructive,
handler: { _ in alert.dismiss(animated: true)
// generate test crash
Crashes.generateTestCrash()
fatalError()
}))
present(alert, animated: true)
}