NSArchiver problem
NSArchiver problem
- Subject: NSArchiver problem
- From: Adrian Ridner <email@hidden>
- Date: Wed, 29 Aug 2001 11:02:42 -0700
Hello all,
I have a problem with NSArchiver and I'm hoping someone ran into it
before. It is very simple. I'm trying to archive my own object before
my application terminates. In my delegate I listen for
NSApplicationWillTerminateNotification and call a method. Inside that
method I use:
if ([NSArchiver archiveRootObject:myObj toFile:myPath]) {
NSLog(@"Saved myObj");
}
And I unarchive the same object when my application starts. The problem
description goes as follows: The first run, everything works fine. No
objects to unarchive, so I create a new one, when user Quits, object is
saved. Then 2nd run for the app it restores the object, but when it
goes to save it quits with signal 10 (SIGBUS). After some digging I
found out that if I physically delete the file created the previous time
(from the Finder) anytime before I Quit my app, the object will be
archived successfully. What really throws me off is that if I
programatically delete the file, it will not work. What am I missing?
Thanks for your help,
Adrian
***************************************
Adrian Ridner
Mac Software Team
Hewlett-Packard
***************************************