ARC下performSelector may cause a leak

解决办法:定义一个宏

#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 leak)