问题现象
某些时候使用了一些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/》