Reputation: 483
I am using the NSMetaDataQuery to search for iCloud documents, as recommended, but it's also searching sub-directories. Is there any way to have it search only the root directory? My code at the moment is...
NSMetadataQuery *query = [[NSMetadataQuery alloc] init];
_query = query;
[query setSearchScopes:[NSArray arrayWithObject:
NSMetadataQueryUbiquitousDocumentsScope]];
NSPredicate *pred = [NSPredicate predicateWithFormat:
@"%K == %@", NSMetadataItemFSNameKey, optionsFilename];
Thanks! Ray
Upvotes: 1
Views: 549
Reputation: 1429
I hope it isn't too late for my answer...
I have the same issue but after a while I found a way to get this done: Compare resource URL without last path component against desired directory path.
NSPredicate(format: "%K.URLByDeletingLastPathComponent.path == %@", argumentArray: [NSMetadataItemURLKey, iCloudDocsURL.path])
This predicate works like a charm!
Cheers
Upvotes: 3