[Cocoa] custom prefix. PCH file in xcode

Source: Internet
Author: User

Customize prefix. PCH files in xcode

Luo chaohui (http://www.cnblogs.com/kesalin)

This article follows the "signature-non-commercial use-consistency" creation public agreement


The extension PCH indicates the "precompliled Header", that is, the pre-compiled header file. prefix. PCH is the default pre-compiled header file generated by the xcode project. In this file, we can customize some global macros to facilitate development.

The following post is from
Cocoa is my girlfriendCustomized macros:

 

# Ifdef debug
# Define Dlog (...) nslog (@ "% S % @", _ pretty_function __, [nsstring stringwithformat :__ va_args _])
# Define Alog (...) [[nsassertionhandler currenthandler] handlefailureinfunction: [nsstring stringwithcstring :__ pretty_function _ encoding: encoding] File: [nsstring stringwithcstring :__ file _ encoding: encoding] linenumber: __line _ description :__ va_args _]
# Else
# Define Dlog (...) do {} while (0)
# Ifndef ns_block_assertions
# Define Ns_block_assertions
# Endif
# Define Alog (...) nslog (@ "% S % @", _ pretty_function __, [nsstring stringwithformat :__ va_args _])
# Endif

# Define Zassert (condition,...) do {If (! (Condition) {alog (_ va_args _) ;}} while (0)


For more information, see the original article. Here I will only describe its usage:

1. In debug modePreprocessor
Set the debug macro in macros;

2. dlog is equivalent to nslog, but only valid in debug mode;
In release mode, it does nothing;

3. alog is short for assert log. In debug mode, it is equivalent to forced
Assert; in release mode, it is equivalent to nslog;

4. zassert is a alog with conditional judgment;


References:
My current prefix. PCH File


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.