How to receive notifications when files added to document package?

I have an exported UTI which is a document package, and the file and folder structure within it are dynamic and could be changed from another device. NSMetadataQuery will not read within a document package. So my questions are:


- How can I receive a list of files contained in the package along with their download status?

- How can I keep the list updated when files are added to the package from other devices?


Thanks!

Accepted Reply

I have inferred, in part for the conversation in this thread: (https://forums.developer.apple.com/thread/87235), that the file package is trated by iCloud as a single file and is reported with a single download status. I think that means that one should simply implement readFromFileWrapper in order to receive changes through file coordination.


I have yet to see direct confirmatoin for this though, and the docs elude to this but there are no specific examples that I know of.

Replies

I have inferred, in part for the conversation in this thread: (https://forums.developer.apple.com/thread/87235), that the file package is trated by iCloud as a single file and is reported with a single download status. I think that means that one should simply implement readFromFileWrapper in order to receive changes through file coordination.


I have yet to see direct confirmatoin for this though, and the docs elude to this but there are no specific examples that I know of.

Turns out this is the case. Though the Apple docs for NSDocument/UIDocument are not necessarily clear about this, if you implement your file wrapper structure as indicated in the docs examples this will be taken care of for free at the granularity of a single file contained in a document package.


The download status only applies to the document package as a whole and is returned for the package file (folder as file) from NSMetadatQuery.