queryDidReceiveNotification not being called (iOS 14 only)

I have an app that can run on iPhones and iPads. Prior to iOS 14, when the app running on one device writes to iCloud Drive the app running on the other device would receive a queryDidReceiveNotification (setup using NSMetadataQuery). This is no longer the case. Again this worked flawlessly prior to iOS 14.

Interestingly if I do a contentsOfDirectoryAtPath for that iCloud location the new file added by the other device is not included. BUT if the device (the device not seeing the file or receiving the notification) then adds something to that location and then subsequently does a contentsOfDirectoryAtPath the new file magically is included in the list of files.

Has anyone else encountered this or is aware of a bug in iOS 14 which does not send a notification out.

It is almost like there is some cache being used under iOS 14 that is not being refreshed properly (also resulting in the lack of notification via queryDidReceiveNotification for an outstanding NSMetaDataQueary).
I have exactly the same problem (also IOS 14 only and working in iOS 13).

I found that NSMetadataQuery is broken. If you set up a NSMetadataQuery for a file in an ubiquitous container on iCloud, iOS14 will not receive the NSMetadataQueryDidUpdate notification, when you e.g. delete or modify the file with Finder. Even changes made from the iOS app that is running the query are NOT notified. Again : IOS 14 only.

I think this is a VERY SERIOUS problem which should be solved asap. It renders iCloud sync across devices completely useless !

Furthermore the NSFilePresenter protocol is also broken. If you set up a FilePresenter to monitor an iCloud ubiquitous file, the presentedItemDidChange() never gets called under iOS14. In iOS 13 it works as intended. Please note that file changes using a file NSFileCoordinator initiated by iOS 14 are propagated to iOS 13 devices that are registered as presenters, but not vice versa.

I think both problems are highly related.

I have already submitted a TSI and reported a bug in feedback assistant, but nobody cares !

@Others: Please submit these bugs as well so that we receive awarenesses for this serious problem !

@Apple: Please help ASAP

Finally here my posts for both problems on SO: https://stackoverflow.com/questions/64444494/ios-14-nsmetadataquery-not-updating-no-notifications-are-sent-works-on-ios13

https://stackoverflow.com/questions/64446024/ios-14-nsfilepresenter-not-getting-callbacks-notifications-works-on-ios13
I have not heard anything from Apple regarding the bug I reported described in the original posting. I am planning on using one of my Code-Level Support questions available to my developer account to see if I can find a dev support engineer who can provide me further information on this issue. I total agree with chnbr that this is a very serious issue.

I have worked up somewhat of a workaround. Prior to doing a contentsOfDirectoryAtPath I add a temporary folder. By doing this it appears to refresh the cache used by this routine so that it returns an accurate list of the files in that directory. This is by no means a complete solution because what I truly need is to receive a queryDidReceiveNotification which then will trigger my app to proceed with the task it needs to do when it learns a file has been added to that directory.

I will keep this post updated as to any progress.

Please do use one of your TSIs, since this would produce more credibility that this problem really exists !!! I also did submit one of my TSIs....

Meanwhile I am in communication with an Apple engineer, but the problem is, he is claiming the problem does not occur on his side. I am still insisting and providing a test project that clarifies the problem and I have also made a video that they can see what is happening live.

Tho whole thing did cost me way too much time and still the bug is not at all confirmed by Apple. So please support my request by creating a bug report and submitting an TSI.

Maybe you could change the title of this thread to "NSMetadataQueryDidUpdate", which is the official name of the notification. It might increase the probability that people find this thread.

Thanks
Correct me if I'm wrong, not sure if it's the same case since we're using an API and dont know anything about Objective C or Swift.
We are using an api that uses GameKit to save game progress and sync between devices, and I've noticed whenever I save a file on a device with iOS less than 14, the iOS 14 device doesn't get the changes, specially the first time. It's strange because the container that appears in the iCloud storage management appears, also the KB that is using, but the device is not able to find any saved game.

If I do it the other way around it works well. iOS 14 saved games are synchronized almost immediately to the lower iOS devices.
Is this the problem you are talking about?

If this is the case, how can we help to ask for a fix to apple?

Thanks


Any news on this ?
I have the same issue and I submitted a TSI too, however the process not yet start as I used a phantom email as my Apple ID (created long long time ago so that I can use a phantom email as my Apple ID, however, Apple changed its TSI process now and won't use my alternative email), so I need Apple support to help me change the TSI email to my real one in order to start the communication.

I guess if support said the issue not happen at his side, then it may be good sign as there may be some settings on the device to make it works.
For the same problem, like caching, unless new files are added, does anyone have a solution?
FWIW, I've am also seeing the same problem: iOS 14.3 not receiving the NSMetadataQueryDidUpdate notification.

However, moving to iOS 14.4 and XCode 12.4 has helped on an iPhone device. My app on iPhone iOS 14.4 is definitely getting notifications.

OTOH, the same app on iOS 14.4 on an iPad is definitely *still not* getting notifications without a local change to the cloud.

If I update iCloud documents on the iPad, a notification is recieved (NSMetadataQueryDidUpdate).

So, for me, the "only" thing missing is a working NSMetadataQueryDidUpdate on an iPad w/14.4.
queryDidReceiveNotification not being called (iOS 14 only)
 
 
Q