For the complete documentation index, see llms.txt. This page is also available as Markdown.

Crash Reporting User Consent

Ask your iOS users to confirm before a crash report leaves the device, using the Luciq callback that holds crash data until consent is given.

Suppose you want your users' confirmation before sending a crash report to Luciq. In that case, the Luciq SDK exposes a callback awaiting each user's confirmation before sending any crash/error data to Luciq.

This callback function instructs Luciq to await user confirmation before sending crash reports. It is designed to enhance end-user privacy and control by allowing them to approve or decline the submission of crash reports, ensuring a more transparent and user-centric experience.

This callback applies to fatal errors (crashes) and out-of-memory (OOM) reports, force restarts, and excludes app hangs and non-fatal errors.

If no response is received within a 2-minute window, the callback triggers a timeout mechanism, preventing the automatic crash report sending.

Example Usage

 CrashReporting.onWillSendCrashReportHandler = { crashType, completionHandler in

            let crashTypeAsString: String

            switch (crashType) {

            case .crash:

                    crashTypeAsString = "Fatal Crash"

            case .forceRestart:

                    crashTypeAsString = "User termination Crash"

            case .OOM:

                    crashTypeAsString = "OOM Crash"

            @unknown default:

                fatalError()

            }

            let message = "Are You Sure Want to send Crash! for crash type: \(crashTypeAsString)"

            let alert = UIAlertController(title: "Crash Consent", message: message, preferredStyle: .alert)

            let yesButton = UIAlertAction(title: "Yes", style: .default, handler: { _ in

                completionHandler?(.accept);

            })

            alert.addAction(yesButton)

            let noButton = UIAlertAction(title: "No", style: .default, handler: { _ in

                completionHandler?(.reject);

            })

            alert.addAction(noButton)

            let rootViewController = UIApplication.shared.keyWindow?.rootViewController

            rootViewController?.present(alert, animated: true)

        }

Last updated