title: UIDocumentPickerViewController not calling didPickDocumentAtURL on Mac Catalyst
body: <p>I have this code in a <code>UIViewController</code> that confirms to <code>UIDocumentPickerDelegate</code>:</p>
  
  <pre><code>- (void)openTextFilePicker {
      NSArray *UTIs = [NSArray arrayWithObjects:@"public.text", nil];
      [self openFilePicker:UTIs];
  }
  
  - (void)openFilePicker:(NSArray *)UTIs {
      UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:UTIs inMode:UIDocumentPickerModeImport];
      documentPicker.delegate = self;
      documentPicker.popoverPresentationController.barButtonItem = self.importButton;
      [self presentViewController:documentPicker animated:TRUE completion:nil];
  }
  
  - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURLs:(NSArray&lt;NSURL *&gt; *)urls {
      [self documentPicker:controller didPickDocumentAtURL:[urls firstObject]];
  }
  
  - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
      NSLog(@"picked document %@", url);
  }
  
  - (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {
      NSLog(@"cancelled");
  }
  </code></pre>
  
  <p>This works fine in iOS. In Mac Catalyst, the file picker opens, I can navigate and select a file, but when I click the Open button in the picker, neither <code>didPickDocumentAtURLs</code> nor <code>didPickDocumentAtURL</code> are called. However, if I click the Cancel button in the picker, <code>documentPickerWasCancelled</code> is called.</p>
  
  <p>When I click Open, this error appears in the console:</p>
  
  <blockquote>
    <p>Failed to associate thumbnails for picked URL file:///**** with the
    Inbox copy file:///****: Error Domain=QLThumbnailErrorDomain Code=102
    "(null)" UserInfo={NSUnderlyingError=0x600000da9a10 {Error
    Domain=GSLibraryErrorDomain Code=7 "no storage for file:///****"
    UserInfo={NSDescription=no storage for file:///****}}}</p>
  </blockquote>
  
  <p>I thought that might mean I had a problem with my sandbox security settings, but when I change the picker mode to <code>UIDocumentPickerModeOpen</code>, that error no longer occurs but <code>didPickDocumentAtURL</code> still isn't called. Anyway, here are my sandbox settings:</p>
  
  <p><a href="https://i.stack.imgur.com/HAmsU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HAmsU.png" alt="sandbox settings with User Selected File set to Read/Write"></a></p>
  
  <p>I've seen posts about the document picker opening blank, but that's not the problem here. I've only seen one post that seems to confirm it does work, but that was using Swift ... could it be working in Swift but broken in Objective C? Is there something else I'm missing to make this work?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here's <a href="http://www.arlomedia.com/projects/apps/DocumentPickerTest.zip" rel="noreferrer">a new Xcode project</a> with the minimum code to demonstrate the problem. As with my full project, this works fine on iOS, but doesn't call the <code>didPickDocument...</code> delegate methods on Mac.</p>