0

When it needs folder permission in Sandbox, The Unarchiver will show a window like below.

I can ask permission myself using NSSavePanel, but there is an extra file name text field. If I try NSOpenPanel, the open button is grey. So my question is, can I get the exact window liked below? How can I do it?

enter image description here

Owen Zhao
  • 3,205
  • 1
  • 26
  • 43
  • It seams that there was a deprecated method - runModalForDirectory:file:types: (OS X v10.6), which is not available in swift. – Owen Zhao Feb 02 '16 at 02:18

1 Answers1

0

Now I know how to do.

let openPanel = NSOpenPanel()
openPanel.directoryURL = self.file.folderURL
openPanel.message = "Need your permission to save to this directory."
openPanel.prompt = "Save"

openPanel.allowedFileTypes = ["none"]
openPanel.allowsOtherFileTypes = false
openPanel.canChooseDirectories = false
openPanel.canChooseDirectories = true

let result = openPanel.runModal()

enter image description here

Owen Zhao
  • 3,205
  • 1
  • 26
  • 43