1

I'm getting the following warning by the ARC compiler:

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

Here's what I'm doing:

[_controller performSelector:NSSelectorFromString(@"someMethod")];

But under Apple Demo, they don't have this Warning for the same code. Anyone know why?

Rob
  • 435
  • 1
  • 5
  • 25
ray zhang
  • 11
  • 2

1 Answers1

1

That sample is not an ARC project. The warning you cite is the default with ARC projects.

justin
  • 104,054
  • 14
  • 179
  • 226
  • Does this mean that I cannot do dynamic selector in ARC environment without compiler warning? Or there is a different way to do this? – ray zhang Feb 24 '12 at 03:59
  • 1
    you can. however, the responsibility is all yours to verify that the reference counting is always correct. – justin Feb 24 '12 at 04:01
  • Hi @rayzhang here's a bit more about this warning - http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown – Rog Mar 18 '12 at 21:21