Generates an assertion if a given condition is false.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Assertions evaluate a condition and, if the condition evaluates to false, call the assertion handler for the current thread, passing it a format string and a variable number of arguments. Each thread has its own assertion handler, which is an object of class
NSAssertion. When invoked, an assertion handler prints an error message that includes method and class names (or the function name). It then raises an
NSCAssert5 macro evaluates the condition and serves as a front end to the assertion handler. This macro should be used only within C functions.
condition expression must evaluate to true or false.
description is a printf-style format string that describes the failure condition. Each
argn is an argument to be inserted, in place, into the description.
Assertions are disabled if the preprocessor macro
NS is defined. All assertion macros return void.