Is there a way to know whether or not the NSMetadataQuery is still gathering metadata (or is still running)? I mean,in my program I set the search scope to a single directory; now, the query is simple so it takes a few time to collect all the data. How can I know if he finished or not?
A:
I would recommend you take a look at the NSMetadataQuery Class Reference. It has information about the NSMetadataQuery
, including two methods (-isGathering
and -isStopped
)...
itaiferber
2010-10-01 01:05:57
I had already seen the documentation page (and this two methods), just I made a bit of confusion because of "Queries have two phases: the initial gathering phase that collects all currently matching results and a second live-update phase.". I do not get what the second phase consists in...
al fred
2010-10-01 11:15:02
From what I understand, the query goes through two phases (as you wrote: the initial 'gathering' phase, and the 'live-update' phase). During each phase, the query sends out notifications depending on what it is doing (every set interval, it will send out an `NSMetadataQueryDidUpdateNotification` to let you know that it has live-updated. I would assume that you would up an upper time limit on the search, and then kill it when the time is up (the search will usually come up with all results within thirty seconds, but I recommend you test this out yourself...).
itaiferber
2010-10-02 00:59:23