I’m struggling with the Silver Challenge. I made a simple Base Cell class that works generically, but I wanted to extends its functionality by creating something more dynamic: a method that forwards an array arguments (up to 2 max). I had it all set up and ready to rock - EXCEPT when one of the arguments was a selector (as is the case in this chapter/challenge); NSArray won’t take selectors in their raw form. Boo.
So, I started hunting down a way to accomplish this and came across NSMethodSignature and NSInvocation, which led me to forwardInvocation:. This combination of classes & methods seems perfectly suited to accomplish the type of work we’re doing in the latter half of this chapter (although to be fair I can’t get the code working how I like). But is it?
My question: why don’t we use these classes and methods for this purpose? If not for this purpose, why do those methods and classes exist? Why is performSelector:withObject:withObject: better than forwardInvocation:?
Here are some links for reference…: