ICloud - NSMetadataQuery returns old results showing deleted files

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

I can even download them after deleting. Does anyone know what is causing the queries to return incorrect results / what can I do to prevent this?

+3


source to share


1 answer


I just noticed the same problem. I registered the urls of the document and saw that the documents that are in a folder named .Trash

.

Here's how to reproduce that:



  • I delete a document in iCloud Drive on my Mac in Finder
    • β†’ Document disappears from my Mac
  • The document is still showing on iOS, but the path for NSMetadataItem

    now contains .Trash
  • If I empty the trash bin 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.

0


source







All Articles