After some more time on this, I still don't get it. =)

> I've given this a go, but it does not seem to work for me. I set the new 
> fileType after [super readFromURL:...] is done. Then, when 
> - (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName 
> forSaveOperation:(NSSaveOperationType)saveOperation completionHandler:(void 
> (^)(NSError *errorOrNil))completionHandler
> gets called, the arguments are as expected (i.e. the URL is still the 
> original file with the "incorrect" extension and the type is the writable 
> type I set myself), nevertheless, the URL is never changed and it ends up 
> overwriting my original file in the wrong format. :(
> 
> Could this be due to me using a NSFileWrapper-based directory package 
> (whereas the read-only type is a simple flat-file)?

I've made an example project showing my problem from the NSDocument-based 
application template, it can be found at
http://www.maven.de/code/DiagSavingProblem.zip
The example only overrides, fileWrapperOfType:error, 
readFromFileWrapper:ofType:error, 
saveToURL:ofType:forSaveOperation:completionHandler: as well as 
autosavingFileType and autosavesInPlace (and readFromURL to modify the edited 
state).

Oddly enough, the TextEdit example *should* end up with the same problem when I 
create a .rtf-document, drag an attachment into it (so it becomes .rtfd), and 
then close the document. Unfortunately, it works fine for TextEdit but I cannot 
see anything between my example and TextEdit that could cause it to behave 
differently, even after having put breakpoints onto every imaginable message.

Can anyone see what I'm doing wrong or differently from TextEdit?

Thanks,
        Daniel._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to