Apple defines such a macro in Foundation.framework: #define NSASSERT (condition, desc, ...)
Nsassert () is just a macro that is used for bugs in the development phase of the debugger, by passing conditional expressions for Nsassert () to determine if a bug is true, to satisfy a conditional return truth, to run a program, to throw an exception if a false value is returned, and to customize the description of the exception. Nsassert () is defined in this way:
#define NSASSERT (condition, desc)
condition is a conditional expression, with a value of Yes or No;desc as an exception, usually nsstring. When the program continues to run when Conditon is yes, exception information with desc description is thrown when no. Nsassert () can appear at any location in the program.
The first argument is a condition, and if False, throws an exception, showing the information described by the second argument. For example Nsassert (2>=4.4, @ "2>=4.4 is false!"); Running in debug mode terminates the program and throws the following exception: 2016-06-14 09:24:16.618 testassertion[825:c07] * * * terminating app due to uncaught exception ' Nsinternalinconsistencyexception ', Reason: ' 2>=4.4 is false! '
2016-06-14 13:58:25.132 demoforxib[13512:1550607] * * * Assertion failure in-[viewcontroller click:],/users/mac/ Desktop/demoforxib/demoforxib/viewcontroller.m:123 runs in release mode without terminating the program without throwing an exception. This facilitates the commissioning of the program.
Use of Nsassert