objective-c - 如何让XCode不提示某个Warning

浏览:37日期:2023-12-20

问题描述

我在代码里写了一个

[self performSelector:NSSelectorFromString(callback)];

XCode提示

PerformSelector may cause a leak because its selector is unknown

但是我自己而已确定这个selector一定存在,有没有什么办法可以不要让这一行提示错误

问题解答

回答1:

#pragma clang diagnostic push#pragma clang diagnostic ignored '-Warc-performSelector-leaks'[self performSelector:NSSelectorFromString(callback)];#pragma clang diagnostic pop回答2:

如果想忽略整个文件 就用-w

相关文章: