Hi all,

I am trying to make use of NSPersistentDocument's metadata APIs.  I'm
having trouble with the 'when' more than the 'how'.

Which method of the saving process should I override to call
setMetadata:forPersistentStoreWithURL:error:?

All the metadata APIs want the NSURL of the store, which seems to be a
problem when a document is saved the first time.

<http://developer.apple.com/documentation/Cocoa/Conceptual/
NSPersistentDocumentTutorial/07_Metadata/chapter_8_section_4.html#//
apple_ref/doc/uid/TP40002835-SW11> says: "When a document is saved, Core
Data calls the NSPersistentDocument method
writeToURL:ofType:forSaveOperation:originalContentsURL:error:. You can
override this method to add metadata to the new store before it is
saved."  The sample overrides the method and first does:

 if ([self fileURL] != nil)
   [self setMetadataForStoreAtURL:[self fileURL]];

but 'fileURL' returns nil when a document is being saved for the first
time.  If I try using the URL passed in writeToURL I get the exception
"*** -metadataForPersistentStoreWithURL:error: cannot be sent to an
abstract object of class NSPersistentStore: Create a concrete instance!"

Thanks,

--
____________________________________________________________
Sean McBride, B. Eng                 [EMAIL PROTECTED]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to