On 14 Jul 2009, at 01:22, DKJ wrote:
I've defined my own MyClass and made it conform to the NSCoding
protocol by adding methods like this:
- (void)encodeWithCoder:(NSCoder *)encoder
{
[encoder encodeInt:index forKey:@index];
}
- (id)initWithCoder:(NSCoder *)decoder
{
self = [super
On 14-Jul-09, at 2:51 , Mike Abdullah wrote:
Slightly separate to the question, have you actually declared that
your class conforms to the protocol, or just implemented the
methods? i.e. the header should be something like:
MyClass : NSObject NSCoding
Yes, I declared it as well. And
I've defined my own MyClass and made it conform to the NSCoding
protocol by adding methods like this:
- (void)encodeWithCoder:(NSCoder *)encoder
{
[encoder encodeInt:index forKey:@index];
}
- (id)initWithCoder:(NSCoder *)decoder
{
self = [super init];
index = [decoder
Hey dkj -
The method -[NSArray writeToFile: atomically:] uses property list
serialization, and property lists support a fixed set of types. You
want to serialize your NSArray with an NSCoder, like NSKeyedArchiver,
and then read it back in with NSKeyedUnarchiver.
Take a look at these two