Is the parameter for NSKeyedArchiver archivedDataWithRootObject: supposed to be the array I am trying to save, or the array converted into NSData?
+2
A:
To convert a generic array to an NSData
, you need an archiver! If you know how to feed the NSData
, you know how to use NSKeyedArchiver
. So:
NSArray* array= ... ;
NSData* data=[NSKeyedArchiver archivedDataWithRootObject:array];
Of course all elements in your array
needs to implement encodeWithCoder:
.
Yuji
2010-09-19 16:42:57