search

Home  >  Q&A  >  body text

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

我在代码里写了一个

[self performSelector:NSSelectorFromString(callback)];

XCode提示

PerformSelector may cause a leak because its selector is unknown

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

PHP中文网PHP中文网2769 days ago385

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-21 11:18:05

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

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-21 11:18:05

    If you want to ignore the entire file, use -w

    reply
    0
  • Cancelreply