I need to cast a boolean as an object, or NSKeyedArchiver throws a memory access error. What's the best way to do this?
views:
74answers:
2Ah, I wasn't aware that function was available. Thanks.
Chetan
2009-12-28 06:56:28
"method", not "function". :)
bbum
2009-12-29 00:45:52
+3
A:
Further to NSD's answer, in a general sense: Cocoa often requires actual objects for various methods. When the type you have is an ordinal type, such as int
, BOOL
, or float
, you can wrap it in an NSNumber
. For other types, you may need to wrap it in an NSValue
or NSData
(which is essentially an arbitrary binary buffer of a given length).
gavinb
2009-12-28 07:02:53