For the iCloud plugin I'm writing, I sign my iCloud manager class to these iCloud NSMetaDataQuery watchers:
// Add a predicate for finding the documents NSString* filePattern = [NSString stringWithFormat:@"*.%@", @"*"]; self.metadataQuery = [[NSMetadataQuery alloc] init]; // Before starting to query, it is required to set the search scope. arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]]; // It is also required to set a search predicate. [self.metadataQuery setPredicate:[NSPredicate predicateWithFormat:@"%K LIKE %@", NSMetadataItemFSNameKey, filePattern]]; // Listen for the second phase live-updating [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryDidReceiveNotification:) name:NSMetadataQueryDidUpdateNotification object:nil]; // Listen for the first phase gathering [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryIsDoneGathering:) name:NSMetadataQueryDidFinishGatheringNotification object:nil]; [self.metadataQuery startQuery];
The problem is that none of these selectors actually ever gets called back, not even once, and I especially need NSMetaDataQueryDidUpdateNotification to track the process of uploading / downloading files in the cloud.
It is strange that I worked on it the other day, but for some reason he simply stopped working, and I removed my blind position, trying to understand what the problem was. By subscribing to NSMetadataQueryDidStartGatheringNotification, I see that it begins, but it never ends. This is pretty weird.
I was wondering if anyone has any clue how to deal with this code? Or where else can I find the problem.
Thank you for your time:)
source share