NSDocument -writeToFile:ofType:
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 write
Data:[@"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.