iCloud container Mac App Question About Moving Files: Is a File Coordinator Necessary?

In NSFileManager there is this method to move files to and from iCloud:


- (BOOL)setUbiquitous:(BOOL)

flag
itemAtURL:(NSURL *)
url
destinationURL:(NSURL *)
destinationURL
error:(NSError **)
errorOut


All the samples and information I'm able to find seem to be related to using NSDocument, which my app isn't using. I have a little view in my app that allows users to move an image out from the iCloud container and into a local directory. It seems that simply using NSFileManager moveItemAtURL:toURL:error: works fine both to move a file in and out of the iCloud container on OS X without wrapping everything in a file coordinator block. Is it still necessary to use a file coordinator to move files out of iCloud on the Mac. When I put a file in the iCloud container, the system automatically starts uploading it..even though I'm not using a file coordinator...and my related file presenter still is detecting a change.


Both methods seem to be working the same, I'm just wondering if I should be using a coordinator because it's a good amount of code I can get rid of if it's not necessary.


Thanks.

Replies

(Years later…)

I'm trying to understand File Coordinators now and that seems like a good question.

FileManager methods still work generally even without File Coordinators. The point of File Coordinators is to let multiple apps, or objects within the same app, communicate about the timing of such actions and avoid acting simultaneously. So the relevant question is whether this particular method takes care of file coordination for you, in the same way that NSDocument would if you were using it. I don't think it does, so I'm guessing you should still be supporting file coordination yourself.