Hey,
I am trying to save a document as a package. As a test I wanted to save a plaintext file inside a directory. So I created a new project (cocoa document based) and added to following code (see below).
I also edited the target to set the name, extensions and such.
But when I try to save, I still get a sheet saying this is not possible. No files are actually saved either.
I would prefer not to use filewrapper (save everything in once), as my program will increasingly add files to the package, but will not edit them
afterwards.
Thanks.
PS. I tried google, but couldn't find anything useful for me. I did find the same question, but alas without an answer.
- (BOOL)writeToFileNSString *)fileName ofTypeNSString *)docType
{
NSLog(@"%@",docType);
NSString *str = @"qwerty";
NSData *mydata = [str dataUsingEncoding:NSUTF8StringEncoding];
[mydata writeToFile:[NSString stringWithFormat"%@/%@",fileName,@"test"]
atomically:0];
return YES;
}
I am trying to save a document as a package. As a test I wanted to save a plaintext file inside a directory. So I created a new project (cocoa document based) and added to following code (see below).
I also edited the target to set the name, extensions and such.
But when I try to save, I still get a sheet saying this is not possible. No files are actually saved either.
I would prefer not to use filewrapper (save everything in once), as my program will increasingly add files to the package, but will not edit them
afterwards.
Thanks.
PS. I tried google, but couldn't find anything useful for me. I did find the same question, but alas without an answer.
- (BOOL)writeToFileNSString *)fileName ofTypeNSString *)docType
{
NSLog(@"%@",docType);
NSString *str = @"qwerty";
NSData *mydata = [str dataUsingEncoding:NSUTF8StringEncoding];
[mydata writeToFile:[NSString stringWithFormat"%@/%@",fileName,@"test"]
atomically:0];
return YES;
}