• 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: makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion


  • Subject: Re: makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion
  • From: Markus Spoettl <email@hidden>
  • Date: Sat, 08 Feb 2014 21:31:26 +0100

On 2/8/14 8:43 PM, Trygve Inda wrote:
I am reading a document in the format of the old version of my app and
converting it to a new format. The old version is not a document at all but
is a fixed data file in /Application Support/MyApp/

MyDocument *untitledDoc = [[NSDocumentController sharedDocumentController]
makeDocumentForURL:nil withContentsOfURL:fileURL
ofType:kApplicationDocumentType error:&error];

if (untitledDoc)
{
   [untitledDoc makeWindowControllers];
   [untitledDoc showWindows];
   [untitledDoc setFileURL:nil];
   [[NSDocumentController sharedDocumentController] addDocument:(NSDocument
*)untitledDoc];
}

I have something similar (loading an old file into a document with blank file URL) but instead of do driving the whole documentation creation manually, I let AppKit do it the way it wants to do it.

In other words, have you tried calling -openDocument: on your NSDocumentController setting fileURL to nil when it is done?

Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

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


  • Follow-Ups:
    • Re: makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion
      • From: Markus Spoettl <email@hidden>
References: 
 >makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Can I Hide / Show an NSTextField / NSSecureTextField in Cocoa?
  • Next by Date: Re: makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion
  • Previous by thread: makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion
  • Next by thread: Re: makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion
  • Index(es):
    • Date
    • Thread