I have some details stored inside an NSDictionary. I'm using a Master-Detail view on iPad and after I added the initWithCoder method, my app crashes on start-up and I don't know how to make it work.
The reason I want to use NSCoder is to store my user's data and be able to show it once he starts the app again. NSUserDefaults isn't feasible because I'm storing UITextFields and UISegmentedControls inside the dictionary for ease of handling data.
- (id)initWithCoder:(NSCoder *)aDecoder {
if (self = [super init]) {
personInfo = [aDecoder decodeObjectForKey:myString];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:personInfo forKey:myString];
}
Can anyone please tell me how to use it properly?