objective-c "performSelector may cause a leak because its selector is unknown".

#define SuppressPerformSelectorLeakWarning(Stuff) \
    do { \
        _Pragma("clang diagnostic push") \
        _Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
        Stuff; \
        _Pragma("clang diagnostic pop") \
    } while (0)
SuppressPerformSelectorLeakWarning(
    [_target performSelector:_action withObject:self]  //无返回值
);
id result;
SuppressPerformSelectorLeakWarning(
    result = [_target performSelector:_action withObject:self]  //有返回值
);

 

posted @ 2013-08-29 16:23  OpenSoucre  阅读(267)  评论(0编辑  收藏  举报