介绍一些 iOS 小知识。

忽略警告

  • 废弃

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

// 调用废弃方法...

#pragma clang diagnostic pop

  • 未使用的值

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"

int unused = 0;

#pragma clang diagnostic pop

  • performSelector Leak

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

[self performSelector:aSelector];

#pragma clang diagnostic pop