4

As the title says, my NSMetadataQueries to iCloud sometimes show files that I just deleted from iCloud.

I can even download them after being deleted. Does anybody know what causes the queries to return wrong results / what can I do to prevent this?

Max
  • 2,699
  • 2
  • 27
  • 50

1 Answers1

1

I just noticed the same issue. I logged the document urls and saw that the documents where in a folder named .Trash.

Here's how to reproduce this:

  1. I delete a document in iCloud Drive on my Mac in Finder
    • → The document disappears from my Mac
  2. The document still shows on iOS, but the path for the NSMetadataItem now contains .Trash
  3. If I empty the Trash on my Mac, the file disappears from my iOS app

So the solution is to check if the file is in the trash and hide it.

Mark
  • 6,647
  • 1
  • 45
  • 88