Background: I'm getting EXC_BAD_ACCESS error with the NSKeyedUnarchiver. The archiving seems to be done correctly and I am able to follow the code through the debugger and see the object get created and unarchived, but the minute it attempts to return the object I get the bad access error. I've been reading up on all of the memory management stuff and I can't seem to find where i've gone wrong. Any help is appreciated:
Here is the unarchive method:
Here is the setWManager method which i believe conforms to the standards:
One last thing, I tried something similar to below inside the unarchive method, but it didnt get past the keyedUnarchiver line either. I tried it with the 'retain' and without and arrived at the same outcome.
Any more information needed I can do. Thanks!
Here is the unarchive method:
Code:
- (void) unarchiveManager {
[self setWManager:[[NSKeyedUnarchiver unarchiveObjectWithFile:[self archivePath]] retain]]; // Here is where the error originates.
}
Here is the setWManager method which i believe conforms to the standards:
Code:
- (void) setWManager:(Manager *)newManager {
if (wManager != newManager) {
[wManager release];
wManager = [newManager retain];
}
}
One last thing, I tried something similar to below inside the unarchive method, but it didnt get past the keyedUnarchiver line either. I tried it with the 'retain' and without and arrived at the same outcome.
Code:
Manager *temp = [[NSKeyedUnarchiver unarchiveObjectWithFile:[self archivePath]] retain]; // Didnt get past this line either.
[self setWManager:temp]; // Program never reaches this line.
[temp release];
Any more information needed I can do. Thanks!
Last edited: