An official explanation of what IOS Nsparameterassert is doing

Source: Internet
Author: User

The assertion evaluates a condition that, if the condition is false, invokes the breakpoint handle of the current thread. Each thread has its own breakpoint handle, which is an object of the Nsasserttionhandler class. When invoked, an assertion handle prints an error message that contains the method name, class name, or function name. Then, it throws a Nsinternalinconsistencyexception exception.
assertions evaluate a condition and, if the condition evaluates to False, call the assertion handler for the current Threa D, passing it a format string and a variable number of arguments. Each of the thread has its own assertion handler, which are an object of Classnsassertionhandler. When invoked, an assertion handler prints a error message that includes method and class names (or the function name). It then raises annsinternalinconsistencyexception exception.

This macro is used to confirm the validity of a objective-c method. Simply provide the parameters as a condition on the line. The macro evaluates this parameter and, if False, prints an error log message that contains the parameter and throws an exception.
This macro validates a parameter for an objective-c method. Simply provide the parameter as the condition argument. The macro evaluates the parameter and, if it is false, it logs a error message that includes the parameter and then raise s an exception.

If you define a preprocessing macro, the Ns_block_assertions assertion is forbidden. All the breakpoint macros return void.
Assertions is disabled if the preprocessor macro ns_block_assertions is defined. All assertion macros return void.

An official explanation of what IOS Nsparameterassert is doing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.