Basically, my problem is exactly what it says in the title. When I try to encode a subclass of UIViewController
, calling [super encodeWithCoder]
gives an NSInvalidArgumentException
. Specifically, I get -[UIImage encodeWithCoder:]: unrecognized selector sent to instance XxXXXXXX
.
The only image image in the view is on a UIButton
, which is also supposed to conform to NSCoding, and the stack trace includes a call to [UIBUtton encodeWithCoder]
. The button is created programmatically with [UIButton buttonWithType:UIButtonTypeCustom]
, and the image is set with setImage: forState:
. I really have no idea what is going on here. Am I missing something obvious, or does UIButton
just not really conform to NSCoding
?