zoukankan      html  css  js  c++  java
  • preprocessor设置调试宏

    调试宏:preprocessor设置

    预处理器“调试”宏在Xcode项目模板的调试版本定义。预处理宏在编译时被解释和调试宏可以用来允许调试代码运行在调试版本中你的项目。如果你不确定你的项目已经确定,可以确认这是在Xcode中选择项目,点击Build选项卡设置。搜索预处理和确保调试= 1正在为您调试定义建立(如波纹管)。如果它不是已经定义在您的项目中,您可以添加它。预处理宏是区分大小写的。

    简言之,调试处理器宏就像一个开关,可以用来打开代码的不同部分的代码。具体而言,调试宏的目的是用来打开和关闭源代码相关的调试的不同部分。Xcode,默认情况下,包括定义为degug宏设置为1为调试版本和发布版本0。并且,您可以利用这个优势,在您的调试版本中自动包括额外的调试和日志记录代码。
    下面是一个演示如何使用调试宏的示例:

    - (void)pressButton:(id)sender
    {
    #if DEBUG
        NSLog(@"preparing to press button!");
    #endif
        [self prepareForButtonPress];
     
    #if DEBUG
        NSLog(@"pressing button!");
    #endif
     
        [self activatePressButtonSequence:self withCompletion:^{
    #if DEBUG
            NSLog(@"button sequence complete.");
    #endif
                [self buttonPowerDown];
            }];
        NSLog(@"This line has no DEBUG macro, so it gets printed in both debug and release builds!");
    }
  • 相关阅读:
    es 报错cannot allocate because allocation is not permitted to any of the nodes
    linux下获取软件源码包 centos/redhat, debian/ubuntu
    windows假死原因调查
    k8s-calico
    helm使用
    docker网络模式
    4、formula 法则、原则、数学公式
    powershell自动添加静态IP
    WDS部署Windows server2012初试
    2、puppet资源详解
  • 原文地址:https://www.cnblogs.com/ZGSmile/p/5843208.html
Copyright © 2011-2022 走看看