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

NSDocument -writeToFile:ofType:


  • Subject: NSDocument -writeToFile:ofType:
  • From: David Sinclair <email@hidden>
  • Date: Wed, 16 Apr 2003 18:23:27 -0700

I have a potentially very large document-based data file to save, so want to save it a bit at a time. Therefore I'm attempting to use NSDocument's -writeToFile:ofType: using a NSFileHandle. When attempting to save, I get a sheet saying that the file could not be saved. I reduced the method to its simplest form, as shown below, and it still doesn't work. Is there something else I'm supposed to be doing in there, or elsewhere? Moving the sample dataUsingEncoding: call to -dataRepresentationOfType: and commenting out this method saves the file correctly.

- (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)docType
{
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:fileName];

[fileHandle writeData:[@"Test!"; dataUsingEncoding:NSASCIIStringEncoding]];

return YES;
}

--

David Sinclair, Dejal Systems, LLC - email@hidden

Let Dejal Simon keep an eye on your sites for changes or failures!
http://www.dejal.com/simon/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Painting With the Metal Texture
  • Next by Date: How to know if Classic is running?
  • Previous by thread: Re: Unix Network Programming by Stevens && Mac OS X...
  • Next by thread: How to know if Classic is running?
  • Index(es):
    • Date
    • Thread