问题
The original search runs fine, but any changes to invisible items go unnoticed by the query.
The query can be ran again and it will find the updates.
The query is non-nil and spotlight notifications have not been unsubscribed.
Is this a bug or expected behavior?
I have tested this several times in a few different projects and it seems to hold true.
回答1:
One technique for saving a document bundle is to take advantage of the fact that Spotlight does not import metadata from invisible files or directories.
Emphasis added; quote from a page of the Spotlight Overview.
来源:https://stackoverflow.com/questions/1487641/spotlight-nsmetadataquery-with-invisible-items-do-not-auto-update