I've got sort of a crazy thing going on where I have an NSProxy subclass standing in for a UISwitch. Messages sent to the proxy are forwarded to the switch. Please don't comment on whether or not this is a good design, because in context, it makes sense as an incredibly cool thing.
The dealio is that when I try to add this object as an accessory view to a UITableViewCell, I get the following crash:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UISwitch superlayer]: unrecognized selector sent to instance 0x5889740'
Yes, I could just set the proxy's target as the accessory view, but then I would have to keep track of the proxy so that I could release it at the right time. So, what I really want is to be able to have the proxy retained by the table cell, and released when it is removed from the view just like a normal accessory view.
So, why is -[UISwitch superlayer] (a method which does not exist) being called, and how do I save the world?