• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSPersistentDocument's metadata APIs, when can I set my metadata before saving?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPersistentDocument's metadata APIs, when can I set my metadata before saving?


  • Subject: NSPersistentDocument's metadata APIs, when can I set my metadata before saving?
  • From: "Sean McBride" <email@hidden>
  • Date: Mon, 2 Jun 2008 12:58:37 -0400
  • Organization: Rogue Research

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@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

_______________________________________________

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

  • Prev by Date: Re: many-to-many relationships and retain cycles
  • Next by Date: Re: Get Value from NSArrayController Binding
  • Previous by thread: Re: many-to-many relationships and retain cycles
  • Next by thread: Re: Converting string to double: NSString or NSScanner
  • Index(es):
    • Date
    • Thread