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

Re: NSDocument newbie


  • Subject: Re: NSDocument newbie
  • From: John Stiles <email@hidden>
  • Date: Tue, 26 Jul 2005 07:44:41 -0700

On Jul 25, 2005, at 10:58 PM, James Bucanek wrote:


You want to go one level deeper than the NSData stuff that's provided and override the following methods:


- (BOOL)readFromFile:(NSString*)filename ofType:(NSString*)docType
- (BOOL)writeToFile:(NSString*)filename ofType:(NSString*)docType
- (void)close

Replace them with code that opens and closes your archive/whatever. My readFromFile method simply connects to the database. My writeToFile method does nothing (but return YES) because I never "write" the document. Close your file in the close method.

I also provide implementations of

- (BOOL)readFromURL:(NSURL*)url ofType:(NSString*)type
- (BOOL)writeToURL:(NSURL*)url ofType:(NSString*)type

which simply call readFromFile and writeToFile. I don't know if this is necessary, but it lets me sleep at night.

This makes sense. I will definitely take a look at it today. Thanks for your insights :)


_______________________________________________
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: NSDocument newbie
      • From: John Stiles <email@hidden>
References: 
 >Re: NSDocument newbie (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: Cocoa from carbon - cursor tracking issues
  • Next by Date: Re: Is this a bug in setKeys:triggerChangeNotificationForDependentKey:?
  • Previous by thread: Re: NSDocument newbie
  • Next by thread: Re: NSDocument newbie
  • Index(es):
    • Date
    • Thread