R – Objective-C: How to cast a boolean as an object for use with NSKeyedArchiver

castingmemoryobjective cxcode

I need to cast a boolean as an object, or NSKeyedArchiver throws a memory access error. What's the best way to do this?

Best Answer

How about encodeBool:forKey: instead?