SG1
SG1

Reputation: 2891

Cocoa Sandbox: How to get permission to write multiple files or to a directory with NSSavePanel

So the NSSavePanel currently returns a file url complete with extension, and your app has permission to write to that file.

Is there any way to allow the user to select a directory to write to? For example, if the app is exporting a dozen images at once, the names won't be specified by the user in advance.

Upvotes: 10

Views: 1190

Answers (1)

dinosaur
dinosaur

Reputation: 648

You need NSOpenPanel.

NSOpenPanel * openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles:NO];
[openPanel setCanChooseDirectories:YES];
[openPanel setAllowsMultipleSelection:NO];

Upvotes: 7

Related Questions