What is the right way to move a UIDocument to a new URL?
What is the right way to move a UIDocument to a new URL?
- Subject: What is the right way to move a UIDocument to a new URL?
- From: Roland King <email@hidden>
- Date: Mon, 07 Nov 2011 16:53:17 +0800
I'm a little lost in all the UIDocument and NSFileCoordinator code ..
I have some UIDocuments and they are named, as is the default /Documents/<document name>.<extension>. I understand why that's the recommendation as you can get the name of a document without having to download or open it.
Now I'm implementing renaming, so I need to change the URL for a document to the new one, I don't really want to just copy the contents to a new URL and then delete the old one (or do I?).
I think just calling NSFileManager moveItemAtURL:toURL:error won't play nicely with the file presenter stuff, nor will it cause the UIDocument fileURL to be updated, which is what's used for fileName.
Would it be correct to just instantiate an NSFileCoordinator, then call coordinateWritingItemAtURL:options:error:byAccessor on a background thread, then call itemAtURL:didMoveToURL: or is there another way you're supposed to do this properly with UIDocument (like write a new one and delete the old one or something else I'm missing).
Similarly if this were iCloud, same applies? Can I just move to a new URL in the ubiquity container or I have to do more to make the URL 'official' before moving to it? _______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden