Hi Jerry,
After adding a "Save As Move" command to an application, I was
getting a different but related warning, something like "Document
has been moved, do you really want to save it to a new location?"
The solution was to sprinkle in an extra invocation of
saveToURL:ofType:forSaveOperation:error: immediately after
setFileURL:.
I don't care for that solution, as it means -writeToURL:etc will be
invoked twice. For my documents, that's a heavy penalty. But I do
remember the warning you quoted appearing too often, even after a user
confirmed an external move/rename. My workaround was to add this after
the file is saved successfully:
[self performSelectorIfResponds:@selector(_resetMoveAndRenameSensing)];
It's an undocumented method, so all the usual warnings apply.
If you figure it out, please post the answer for the list archives.
I may need it someday :)
haha.. I did end up with a solution that works for my situation. In my
NSDocument overrides, rather than invoking -writeSafelyToURL:etc I can
call -saveToURL:ofType:forSaveOperation:error: to do the work. The
latter appears to call the former, and properly manages the file
location tracking without generating the erroneous prompts. I don't
know how I earlier missed this obvious solution.
Thanks!
~Martin
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]