作为一个有代码洁癖的程序猿,看到警告就忍不住想要解决,现在开始把解决过的警告记录一下:
1. performSelector may cause a leak because its selector is unknown
方案1:
IMPimp = [_targetmethodForSelector:_selector];//静态选择器解决ARC中因为performSelector的选择器未知可能会引起泄漏报警告的问题
void
(*p)(id,SEL)
= (void
*)imp;
p(_target,_selector);
方案2:
[p
performSelector:@selector(demo1:)
withObject:@"sjflj"];
将@selector写进去就不会有这个警告了