1

I'm working with a joint Mac/iOS app that syncs documents and data via iCloud to one another. In order to detect when data changes, I use NSMetadataQuery to observe the relevant iCloud folder.

The apps also use another purely local data storage that I monitor with an NSMetadataQuery object in case the user deletes or adds documents from Finder.

Each separate NSMetadataQuery objects are given distinct searchScopes so they do not observe each others respective folders by accident.

The problem is that the local Query doesn't always respect its searchScope and will randomly return values outside of it.

Here is an example from one of the times I caught it misbehaving.

(lldb) po docQuery.searchScopes
$1 = 0x0000000101553ae0 <__NSArrayI 0x101553ae0>(
file://localhost/Users/aschenk/Library/Containers/com.chimpstudios.cloudclipboard/Data/Documents/LargeClippings
)

And here is the url of the 'found' file

Erroneous query reporting >> file://localhost/Users/aschenk/Library/Mobile%20Documents/8YJAW5LA57~com~chimpstudios~cloudclipboard/Documents/D7D31630-81B7-47AA-BEE7-71A5B8D96B23.ccc/

For now, I've resorted to double checking that the Query results actually live within the searchScope. This feels like a bug with the API, but I wanted to double check here before I file a report with Apple on the chance that it is something stupid that I overlooked.

4

0 に答える 0