• 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
Re: [KINDA SOLVED] Core Data : Save As : Object temporarily missing...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [KINDA SOLVED] Core Data : Save As : Object temporarily missing...


  • Subject: Re: [KINDA SOLVED] Core Data : Save As : Object temporarily missing...
  • From: Jerry Krinock <email@hidden>
  • Date: Thu, 1 Jul 2010 18:04:03 -0700

On 2010 Jul 01, at 15:38, I wrote:

> I'm debugging a problem with Save As in a Core Data document...

Yeah, I know, that original post was a long shot.

I fixed the problem but still don't understand it.

The "Save As" operation I was debugging is actually a home-made one which also deletes the original.  I had implemented this by sending -[NSPersistentDocument writeSafelyToURL:ofType:forSaveOperation:error:], and manually moving the files and setFileURL: in code.  Upon waking from a nap, I replaced this message with -[NSManagedObjectContext save:], and the problem went away.

Actually, there was another problem I didn't mention in my first post, and that problem went away too.  The second problem was that, during the save, Core Data would register a single Undo invocation which had a nil target, with selector _noop: and argument of type __NSArray0*, which had a -count = 0.  (Thanks to Graham Cox' GCUndoManager for that peek!)  Obviously this action was a no-op, but it dirtied my red button, etc.

In NSPersistentDocument documentation, the only one of the save/write methods overridden from NSDocument is supposedly writeToURL:ofType:forSaveOperation:originalContentsURL:error:, which is the next lower-level method invoked by writeSafelyToURL:ofType:forSaveOperation:error:.  So I don't see what the problem was.  Anyhow, since I'm taking care of the high-level file management stuff as explained above, I'm satisfied that -[NSManagedObjectContext save:] should be sufficient, and it seems to work.

"Message Flow In the Document Architecture" [1] is possibly the single most useful "Programming Guide" page on developer.apple.com, but it doesn't cover the little variations for Core Data.  I just submitted Document Feedback suggesting that they do so.

Jerry


[1] http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Documents/Articles/ObjectInteractions.html

_______________________________________________

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

References: 
 >Core Data : Save As : Object temporarily missing in fetch results (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: set defaults in another application?
  • Next by Date: Using NSImage to render the view
  • Previous by thread: Core Data : Save As : Object temporarily missing in fetch results
  • Next by thread: Re: Core Data : Save As : Object temporarily missing in fetch results
  • Index(es):
    • Date
    • Thread