3

I am writing a macOS document based application in Swift with the following versions:

MacOS: 10.13.4 Xcode: 9.3 Deployment 10.13 Sandbox: On

I have noticed that the search box in the open file dialog is non-functional (ie it returns no results, date categories etc, just an empty view).

Search results in open file dialogue

  • I have not subclassed any important classes beyond those provided in the project template
  • A vanilla document based application cocoa project (also sandboxed) with no edits produces a search box that DOES work:

Search results in open file dialogue for vanilla project

I have done the following so far:

  • Full project clean and build, with deletion of default preferences
  • Rebuild of spotlight index files
  • Ensured all build and project settings are the same as the vanilla project

Please can anyone recommend how I investigate this further, or the type of issue that might be behind it? I am at a loss how to proceed.

Bill Aylward
  • 31
  • 1
  • 1
  • Is jpg a supported document type? Is this "Open…" in the File menu or do you use a `NSOpenPanel`? – Willeke May 09 '18 at 10:58
  • Try turning of your App SandBox – Leo Dabus May 09 '18 at 11:29
  • Good point about .jpg (they were just what I had lying around in that folder), but exactly the same problem occurs with supported file types. I am using the 'out of the box' action method of File->Open, but elsewhere in the application I use NSOpenPanel, and the same problem occurs with that too. – Bill Aylward May 10 '18 at 05:14
  • I have tested with the App SandBox on and off, but no difference – Bill Aylward May 10 '18 at 05:14
  • Ah.. I think Willeke is on to something here. If I add .jpg to the original project's list of supported file types, then the files DO show up on search, but it still does not work for the original supported file types (.kap, .apc) both of which are non-standard – Bill Aylward May 10 '18 at 05:49
  • The same thing happens in the vanilla project, so it seems that to make the search box work, it is a pre-requisite that the file type is supported, but this is not sufficient for some file types. – Bill Aylward May 10 '18 at 05:51
  • This feels like a bug to me. I am going to file a bug report with Apple – Bill Aylward May 10 '18 at 06:15
  • Do supported file types work and you want to select other file types? Did you set `allowedFileTypes`? – Willeke May 11 '18 at 12:27
  • 'Standard' files like jpg work (as long as they are listed in the project document types). If I set allowed file types, then it DOES work. I am not sure how to set it for the open panel that is managed in the background by NSDocumentController, but I can always create a custom one! So I now have a workaround - thanks again Willeke. – Bill Aylward May 12 '18 at 07:22

0 Answers0