Is calling [myObject performSelector:@selector(something) withObject:nil]; the same as just calling [myObject performSelector:@selector(something)];?
Is calling [myObject performSelector:@selector(something) withObject:nil]; the same as just calling [myObject performSelector:@selector(something)]; ?
Share
The only difference is signature of the method you intend on calling from the
@selector. UseperformSelectorwhen the method takes no arguments, and useperformSelector:withObjectif the method takes a single argument of typeid. Otherwise, they both do the exact same thing.From the NSObject Protocol Reference:
As Chuck points out, this isn’t really enforced (at least not at this point in time). The code below executed fine without any exceptions being thrown at me.
On the other hand, this version of the code did cause problems. So it doesn’t work both ways.