The flow I'm trying to achieve is "Make a selection of files and folders in a document browser. Copy the selected items into a folder."
The destination folder is static and resides in the application's Documents folder.
What I have now goes like this:
- Present
UIDocumentBrowserViewControllerwithallowsPickingMultipleItems. - Have the user pick a file stored in iCloud.
- In
didPickDocumentsAtURLsdownload the file. Works fine. - Have the user pick a folder item in iCloud.
- List the folder contents with
NSFileManager. This returns a nice set of NSURLs, but by design these can't be actually used to initiate a download. - List the folder contents using an
NSMetadataQuery. My observer gets notified ofNSMetadataQueryDidFinishGatheringNotification, but the query results are empty. Search scopes and predicate of the query are:
[[self metadataQuery] setSearchScopes:[NSArray arrayWithObjects:NSMetadataQueryUbiquitousDocumentsScope, NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope, url, nil]];
[[self metadataQuery] setPredicate:[NSPredicate predicateWithFormat:[NSString stringWithFormat:@"%%K like '*.*'"]]];
I'm expecting the query results to be a list of files currently present in the provided scopes. I've tried a number of variations for scopes and predicates, but the query's results is always empty.