2

I am using NSMetadataQuery to query a file on iCloud in an ubiquitous container. The code works as expected on iOS13.7, but it does NOT work on iOS14. On iOS 14 no notifications are sent to the app. Is this a known bug or an implementation issue with my code ?

Thanks

var m_basename = "textfile.txt"

override func viewDidLoad() {
  super.viewDidLoad()

  // check for iCloud
  if !ViewController.checkForICloud() {
    fatalError("iCloud not configured")
  }

  // Now configure the meta data query
  m_textFileQuery.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope]
  m_textFileQuery.predicate = NSPredicate(format: "%K LIKE '\(m_basename)'", NSMetadataItemFSNameKey)
  m_textFileQuery.start()

  NotificationCenter.default.addObserver( self,
                                          selector:#selector(textFileQueryDidUpdate),
                                          name:NSNotification.Name.NSMetadataQueryDidFinishGathering, object:m_textFileQuery)
  NotificationCenter.default.addObserver( self,
                                          selector:#selector(textFileQueryDidUpdate),
                                          name:NSNotification.Name.NSMetadataQueryDidUpdate, object:m_textFileQuery)
}
  
@objc func textFileQueryDidUpdate(notification: NSNotification) {
  print(#function, "textFile query found \(m_textFileQuery.resultCount) file(s)")
}
Chris
  • 1,231
  • 2
  • 10
  • 20
  • Same problem here – pistoleta Oct 30 '20 at 18:33
  • I am currently in contact with Apple engineers, but they still refuse to accept the existence of this bug. Please, please file a bug report and direct a TSI to Apple to make them believe there’s a problem. Thanks – Chris Nov 04 '20 at 16:10
  • I already did, and they gave me back TIS and told me I should fill a bug report into the feedback section of the developer panel.... I don't understand anything, I wrote the bug description there but I highly doubt someone is going to look at it. – pistoleta Nov 04 '20 at 16:22
  • OK, thanks. In my experience the only way to get in touch with Apple is the TSI. I had prepared a small demonstration project and used this as a base of the discussion. The final outcome was the Apple engineer did run my project and claimed it worked fine. I have tested on several devices and different iOS versions and I’m absolutely sure there’s something wrong in iOS 14, but I don’t know how to communicate that to Apple... – Chris Nov 04 '20 at 16:58
  • Im not surprised at all.. – pistoleta Nov 04 '20 at 17:01

0 Answers0