基本上,我的问题正是它在标题中所说的。当我尝试对 的子类进行编码时UIViewController,调用[super encodeWithCoder]会给出NSInvalidArgumentException. 具体来说,我得到-[UIImage encodeWithCoder:]: unrecognized selector sent to instance XxXXXXXX.
视图中唯一的图像图像位于 a 上UIButton,它也应该符合 NSCoding,并且堆栈跟踪包括对[UIBUtton encodeWithCoder]. 按钮是用编程方式创建的[UIButton buttonWithType:UIButtonTypeCustom],图像是用 设置的setImage: forState:。我真的不知道这里发生了什么。我是否遗漏了一些明显的东西,或者UIButton只是不符合NSCoding?