I'm trying to access some files stored in the application's documents directory by using an NSMetadataQuery but the NSMetadataQueryDidFinishGatheringNotification doesn't notify my application. I found this question but the answer was to make the NSMetadataQuery an ivar, which I have already done.
Here's the code I am using:
self.query = [[NSMetadataQuery alloc] init];
[self.query setSearchScopes:[NSArray arrayWithObject:documentsDirectoryURL]];
NSPredicate *pred = [NSPredicate predicateWithFormat:@"%K ENDSWITH '_task'", NSMetadataItemFSNameKey];
[self.query setPredicate:pred];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryDidFinishGathering:) name:NSMetadataQueryDidFinishGatheringNotification object:self.query];
[self.query enableUpdates];
[self.query startQuery];
Thanks for your help!