Code Diagnostics

Enable runtime checks to detect and avoid bugs in your code.

Overview

Xcode provides several code diagnostics tools for you to use when running your app during development. To enable code diagnostics for your app in Xcode, select your app scheme and choose Product > Scheme > Edit Scheme.

Enable sanitizers and other diagnostic tools in the Code Diagnostics section of the Run action in the Scheme Editor.

Select the Run or Test action in the sidebar and navigate to the Diagnostics section. Under Runtime Sanitization, select the sanitizers that you wish to enable.

Topics

Memory

Address Sanitizer

Track down memory violations in your code.

Threading

Thread Sanitizer

Audit threading issues in your code.

Main Thread Checker

Detect invalid use of AppKit, UIKit, and other APIs from a background thread.

Undefined Behavior

Undefined Behavior Sanitizer

Discover and fix undefined behavior in your code.