Hi,
I have been NSMetadataQuery to monitor the Documents folder of my app to pick up new files that were added. This stopped working in Catalina. Is this a documented issue or change in functionality? Is there any new security permission or privacy thing that I have to enable in my app to continue monitoring the local Documents folder from my own app?
This is the code I was using the setup folder monitoring (which works fine in Mojave ... but not in Catalina):
self.metadataQuery = [[NSMetadataQuery alloc] init];
[self.metadataQuery setSearchScopes:@[dropLocation.path]];
[self.metadataQuery setPredicate:[NSPredicate predicateWithFormat:@"%K LIKE '*.eml'", NSMetadataItemFSNameKey]];
[[NSNotificationCenter defaultCenter] addObserverForName:NSMetadataQueryDidFinishGatheringNotification
object:self.metadataQuery
queue:nil
usingBlock:^(NSNotification *note) {
// do nothing ... not sure why it's required
NSLog(@"NSMetadataQueryDidFinishGatheringNotification called");
}];
[[NSNotificationCenter defaultCenter] addObserverForName:NSMetadataQueryDidUpdateNotification
object:self.metadataQuery
queue:nil
usingBlock:^(NSNotification *note) {
NSLog(@"NSMetadataQueryDidUpdateNotification called");
[self processResultsForQueryWithStartDate: date];
}];
[self.metadataQuery startQuery];