I have an unrelease UIDocuments app in development that adds Observers for NSMetadataQueryDidFinishGathering and NSMetadataQueryDidUpdate. It calls the same routine for both notifications which handlers them by using the results from the NSMetadataQuery and updating the list of URLs from the cloud. All of this has worked for more than a year and is programmed according to Apples documentation. It is also the same implementation as presented by Ray Wenderlich in "ICloud and UIDocuments Beyond the Basics" from 2012.
Part of the process is to open the UIDocument file/fileWrapper to harvest information for display in a tableView.
With the introduction of ios 11, I am having a problem. The act of opening a UIDocument causes a new NSMetadataQueryDidUpdate notification which causes me to reload the URLs and open the UIdocuments which causes a new NSMetadataQueryDidUpdate notification... until the app crashes.
The same thing happens with Ray's App.
Opening a UIDocument did not cause a NSMetadataQueryDidUpdate notification before ios 9.
I looked through the Apple Documents and WWDC videos to see if there was a defined solution for this but I did not find one.
Is this a bug or what can I do to fix this?