zoukankan      html  css  js  c++  java
  • 消除部分xcode警告

    问题现象

    某些时候使用了一些deprecated的方法,每次编译xcode都会有提示,想去掉这些指定遗弃方法使用的提示

    问题解决

    #define WC_DeprecatedDeclarationsWarning(stuff)

    do {

    _Pragma("clang diagnostic push")

    _Pragma("clang diagnostic ignored "-Wdeprecated-declarations"")

    stuff;

    _Pragma("clang diagnostic pop")

    }while (0)

     

    WC_DeprecatedDeclarationsWarning(

            [APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |

                                                           UIRemoteNotificationTypeSound |

                                                           UIRemoteNotificationTypeAlert)

                                               categories:nil];);

    这样这里的UIRemoteNotificationTypeBadge就不会出现警告

     

    常用警告相关命令

    方法弃用告警    -Wdeprecated-declarations

    不兼容指针类型    -Wincompatible-pointer-types

    循环引用        -Warc-retain-cycles

    未使用变量      -Wunused-variable

    详细列表参考《http://fuckingclangwarnings.com/》

     

  • 相关阅读:
    USACO Name That Number
    USACO Milking Cows
    hdu 1540 Tunnel Warfare (线段树维护左右最长连续区间)
    Contest 1
    JNU周练1026
    树形DP
    Python和C扩展实现方法
    Python模拟C++输出流
    SkipList算法实现
    Python 迭代dict 效率
  • 原文地址:https://www.cnblogs.com/ftrako/p/4221600.html
Copyright © 2011-2022 走看看