During iOS development, the NSLog macro defines

Source: Internet
Author: User

In the process of project development, often encountered in the debugging time to print log, but on-line or release do not need to show the log, at this time you worked hard to write so many log, you either manually commented out, or set a switch variable, try to use the total switch to open. You can actually make full use of the macro definition to set it up.

The step is simple, only need to append your corresponding macro definition in projectname_prefix.pch, can use directly without import.

The macro definition is as follows:

[Plain]View Plaincopy
    1. #ifdef DEBUG
    2. #define LOG (...) NSLog (__va_args__);
    3. #define Log_method NSLog (@ "%s", __func__);
    4. #else
    5. #define LOG (...); #define Log_method;
    6. #endif



Once this is set up, you only need to select the product->scheme->edit Scheme->info, release, or Debug version. If the debug version, then agree to log, if the release version is not printed.

Our release to AppStore is the release version, which is simply the difference between the two versions.
Release is a release version, smaller than the debug version, they call two different bottom-level libraries, debug contains more information, can be breakpoint debugging, stepping, using debug output statements such as using Trace/assert,
However, the release version does not contain debugging information and runs faster.
In addition, the debug parameters set here can be set in the following path: Engineering->target->build Setting->preprocessor Macros. The default system has given the debug parameters. If you want to add new parameters, then where to increase.

During iOS development, the NSLog macro defines

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.