I have a dictionary (it's mutable if that makes a difference) which contains nsarrays, which in turn contain (subclass of NSObject)s I have implemented initWithCoder and encodeWithCoder like this:
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.Title = [aDecoder decodeObjectForKey:@"Title"];
self.SiteAPIURL = [aDecoder decodeObjectForKey:@"SiteAPIURL"];
self.ID = [aDecoder decodeObjectForKey:@"ID"];
return self;
}
-(void) encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:self.Title forKey:@"Title"];
[aCoder encodeObject:self.SiteAPIURL forKey:@"SiteAPIURL"];
[aCoder encodeObject:self.ID forKey:@"ID"];
}
But it doesn't save properly when I do [dictionary writeToFile:savepath atomically:YES];
So what am I doing wrong, and what exactly is serialization and do I need I need to use NSKeyedArchiver or something?