I've ran into a problem. Everytime I'am starting my app it crashes. Heres me code.
The Debugger Says: [list count]
crashes the app. I have no idea. NSLog(@"%@", self.list);
gives me one item as expected...
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
data = [[NSData alloc] initWithContentsOfFile:filePath];
unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
NSMutableArray *array = [unarchiver decodeObjectForKey:@"TOWN"];
[unarchiver finishDecoding];
[unarchiver release];
[data release];
}
self.list = array;
NSLog(@"%@", self.list);
NSLog(@"count %i", [list count]);
The archive which is opened was created like that:
Adding *adding = [[Adding alloc] init];
adding.nummer = 1;
adding.stadt = stadt.text;
NSMutableData *data = [[NSMutableData alloc] init];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc]
initForWritingWithMutableData:data];
[archiver encodeObject:adding forKey:@"TOWN"];
[archiver finishEncoding];
[data writeToFile:[self dataFilePath] atomically:YES];
If you need any futher code let me know. I would be very thankfull for any help :)