Enumerating directories

I'd like to enumerate the files in a directory chosen by the user within a UIDocumentPickerViewController.


I get the directory URL returned from the document picker.

I call startAccessingSecurityScopedResource

I create an NSFileCoordinator instance and begin coordinated read of the directory. Inside my read handler I attempt to get the contents of the directory using FileManager. I see that there are a bunch of blah.png.icloud files in the directory.


This makes sense because I'm picking a directory within my iCloud drive, but what's the right way to enumerate the contents of this directory? I don;t think I should make read-coordinators for each item. That seems kind of heavy...


I only need to enumerate these files for two things:

image meta data

image data


I feel like NSMetaDataQuerys would be my best bet to accomplish this, but they don't seem to like using the URL provided to me by the document picker as the "query scope". (The queries begin, but never update or finish)


Anyone know of any good resources for this? I see a lot of stuff about reading the ubiquitous directories using NSMetaDataQueries, but not the directory locations chosen by a user via the document picker.


Bonus Question: Will I need to initiate full file downloads of the ".icloud" files in order to read their image meta data? (image width and height)

Replies

Updated main post for fomatting. (Could not find this option while on mobile earlier.)