• 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: Importing to core data persistent document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importing to core data persistent document


  • Subject: Re: Importing to core data persistent document
  • From: Gideon King <email@hidden>
  • Date: Thu, 5 Aug 2010 16:02:00 +1000

Thanks Quincey - of course I can do exactly what you say - pick up the fact that they are importing right at the start, ask them where they want the converted file, put it there and open it. Simple and foolproof. Sometimes I can't see the wood for the trees!

setFileURL:nil always worked before, and there's plenty of advice on the net about using it, but no I haven't seen anything in the documentation that advises that it's acceptable for NSDocument, or NSPersistentDocument. I guess I just hadn't expected it to not work, when it was what I have always used (pre core-data), and when I found that it didn't work, I got into the mindset of "what am I doing wrong" or "what am I missing" rather than thinking that it was just a happy coincidence that it worked before.

Thanks again.

Gideon

On 05/08/2010, at 2:25 PM, Quincey Morris wrote:

>
> TBH, when faced with the problem you're trying to solved, I've never dared do anything but stay away from the above kinds of shenanigans. I've always done the less elegant but more robust-seeming:
>
> a. Implement File | Open as a custom action (or, sometimes, intercepting the NSDocumentController's document opening and doing something different, which I guess is what you'd need to do if you wanted File | Open to support both opening and importing, depending on what kind of file was chosen).
>
> b. In the custom action, first asking for the file to import, *then asking for where to save the imported file*.
>
> c. Doing the import, and creating the Core Data store in the specified location without the help of NSPersistentDocument.
>
> d. Generating a NSPersistentDocument Open for the converted file.
>
> IOW, with Core Data documents that are imported, they're never presented to the user as an untitled document. That's unfortunate from a consistency point of view (with NSDocument in general, I mean), but it's certainly reliable. My justification for that is whichever of my questions 1-4 explains why your approach doesn't work. :)
>

_______________________________________________

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: 
 >Re: Importing to core data persistent document (From: Gideon King <email@hidden>)
 >Re: Importing to core data persistent document (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Importing to core data persistent document
  • Next by Date: Re: UIImageView and UIViewContentModeBottomLeft
  • Previous by thread: Re: Importing to core data persistent document
  • Next by thread: NSHTTPCookieStorage
  • Index(es):
    • Date
    • Thread