本文翻译自:performSelector may cause a leak because its selector is unknown
I'm getting the following warning by the ARC compiler: ARC编译器收到以下警告:
"performSelector may cause a leak because its selector is unknown".
Here's what I'm doing: 这是我在做什么:
[_controller performSelector:NSSelectorFromString(@"someMethod")];
Why do I get this warning? 为什么会收到此警告? I understand the compiler can't check if the selector exists or not, but why would that cause a leak? 我知道编译器无法检查选择器是否存在,但是为什么会导致泄漏? And how can I change my code so that I don't get this warning anymore? 以及如何更改我的代码,以便不再收到此警告?
#1楼
参考:https://stackoom.com/question/TRVx/performSelector可能会导致泄漏-因为其选择器未知
#2楼
Matt Galloway's answer on