Where should I put data versioning code?
Where should I put data versioning code?
- Subject: Where should I put data versioning code?
- From: Daniel Wambold <email@hidden>
- Date: Wed, 01 Aug 2007 11:23:15 -0400
I am working on an NSPersistentDocument-based app and, on the advice
received here, have worked out the code to keep data version
information stored in the metadata of my data file. I figured that
the best place to put version checking and updating code would start
with the MyDocument object, but I can't seem to convince this object
to send a message to other objects from the - (BOOL)readFromURL:
(NSURL *)url ofType:(NSString *)fileType error:(NSError **)outError
method. I tried putting an IBOutlet in the File's Owner class for
MyDocument.nib in IB, but to no avail. The program seems to ignore
the line of code (the debugger stops at the breakpoint on that line,
then proceeds to the next line without ever reaching the breakpoint
in the method called in the target object). Are the outlets not
initialized here? I know this method is invoked after awakeFromNib....
Is there a reason I can't send a message to an arbitrary object from
this method? Is there a better way to approach data versioning? The
program can be configured to open the most recently used data file on
launch, and I would like it to be able to verify that the data
version is current before trying to read what might be an out-of-date
data structure. I figured it was better to do this in the MyDocument
object rather than with the controller object, which I assume expects
a given data structure.... Apple's sample code ("Core Recipies >
Sample Applications > Migration") handles the upgrade with an
independent program, but I thought it would be better to integrate
that function into the parent app.
Thanks for the ongoing help!
-Dan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden