美文网首页
ARC下performSelector may cause a

ARC下performSelector may cause a

作者: macfai | 来源:发表于2016-04-24 10:33 被阅读13次

解决办法:定义一个宏

#define SuppressPerformSelectorLeakWarning(Stuff) \

do { \

_Pragma("clang diagnostic push") \

_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \

Stuff; \

_Pragma("clang diagnostic pop") \

} while (0)

然后将你的方法写在stuff处

SuppressPerformSelectorLeakWarning([self performSelector:sel withObject:nil]);

OK,解决

关于ARC下的内存泄露推荐一篇文章挺好的

ARC下有哪些情况会发生内存泄露

相关文章

网友评论

      本文标题:ARC下performSelector may cause a

      本文链接:https://www.haomeiwen.com/subject/uhrfrttx.html