在ARC下使用
[theTarget performSelector:theTarget withObject:Nil];
会出现警告:performselector-may-cause-a-leak-because-its-selector-is-unknown
解决方法:
1:添加如下宏
#define SuppressPerformSelectorLeakWarning(Stuff) do { _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored "-Warc-performSelector-leaks"") Stuff; _Pragma("clang diagnostic pop") } while (0)
2:使用宏
SuppressPerformSelectorLeakWarning([theTarget performSelector:theAction withObject:@"hello"]);