• 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 initForURL:withContentsOfURL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPersistentDocument initForURL:withContentsOfURL


  • Subject: NSPersistentDocument initForURL:withContentsOfURL
  • From: "Mu Lin" <email@hidden>
  • Date: Mon, 26 Sep 2005 12:36:56 -0700
  • Importance: normal
  • Priority: normal

Hi, All:

I am using NSPersistentDocument. I overrided initWithType as such to provide some initial contents for newly created documents:

- (id)initWithType:(NSString *)typeName error:(NSError **)outError
{
NSURL *tempURL = [NSURL URLWithString:@"file://localhost/Users/ SomeBody/Desktop/defaultFile"];


return [self initForURL:nil /* using nil here to get "untitled" and "untitled 2" file display name. */
withContentsOfURL:tempURL
ofType:@"XML"
error:outError];
}


It works fine during the opening but when I save the documents to another file such as "myFile2" using "save as..", the "defaultFile" was blown away. How can I get around of this behavior?

Regards

MarkThis mail server is the property of Spectral Dynamics, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSPersistentDocument initForURL:withContentsOfURL
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: CD: subclassing NSArrayController
  • Next by Date: Re: Finding applications that link to framework
  • Previous by thread: Re: updating a data file to a new version
  • Next by thread: Re: NSPersistentDocument initForURL:withContentsOfURL
  • Index(es):
    • Date
    • Thread