Questions tagged [nssavepanel]

An NSSavePanel object creates and manages a Save panel and allows you to run the panel in a modal loop

An NSSavePanel object creates and manages a Save panel and allows you to run the panel in a modal loop. The Save panel provides a simple way for a user to specify a file to use when saving a document or other data. It can restrict the user to files of a certain type, as specified by an extension.

An NSSavePanel object manages a panel that allows users to specify the directory and name under which a file is saved. It supports browsing of the file system, and it accommodates custom accessory views.

An NSSavePanel object may have a delegate. The methods that delegates of NSSavePanel may implement are specified by the NSOpenSavePanelDelegate protocol.

In a sandboxed app, when a user saves a document, the Save dialog is presented by the powerbox, not AppKit. OS X then adds the saved file to the app’s sandbox (if necessary) to allow the app to write to the file.

More: NSSavePanel Class Reference

118 questions
4
votes
1 answer

Document Type Icon not showing on custom file MacOS

My application needs to have custom document support, but I did not start out with a Document-template in xcode. I did manage to properly load and save the data by following among other things this tutorial:…
4
votes
1 answer

Save/Copy a file from Bundle to Desktop using NSSavePanel

I’m creating a macOS app which ships with some .zip files within its Bundle directory. Users should be able to save these files from my app to a custom directory. I found NSSavePanel and thought it is the right approach — that’s what I have so…
ixany
  • 5,433
  • 9
  • 41
  • 65
4
votes
4 answers

NSSavePanel can't change file name

In my mac app I'm using NSSavePanel - but it's behaving very strange. Sometimes I can't change the default name of the file. I'm using it like this: NSSavePanel *savePanel = [NSSavePanel savePanel]; [savePanel…
Wojtek
  • 1,006
  • 11
  • 30
4
votes
2 answers

NSSavePanel crashes on Yosemite

I am using NSSavePanel to save image. I have used IKSaveOption which gets added to the NSSavePanel. When save panel tries to open the sheet for window it crashes saying - *** Assertion failure in -[IKSaveOptionsContainer…
4
votes
3 answers

NSSavePanel: Squelching the "confirm replace?" dialog

In the Nav Services world one could specify kNavDontConfirmReplacement as an option to create a NavDialogRef that would not ask the user to confirm the replacement of a file when saving with a file name that already exists. How do I specify an…
fbrereto
  • 35,429
  • 19
  • 126
  • 178
4
votes
2 answers

exclude iCloud as option in NSSavePanel/NSOpenPanel

I use iCloud file sync behind the scenes to keep instances of my Mac application in sync so I have the entitlement set for that. Unfortunately, this means that iCloud also appears as a possible save location when I invoke NSSavePanel. Because my…
ecume des jours
  • 2,493
  • 1
  • 19
  • 15
3
votes
1 answer

Doing something after NSOpenPanel closes

I have an NSOpenPanel and I want to do some validation of the selection after the user has clicked OK. My code is simple: void (^openPanelHandler)(NSInteger) = ^(NSInteger returnCode) { if (returnCode == NSFileHandlingPanelOKButton) { //…
alexantd
  • 3,543
  • 3
  • 27
  • 41
3
votes
0 answers

NSSavePanel accessory view disabled in macOS 11 Big Sur

I create a new macOS app in XCode. I add the entitlement com.apple.security.files.user-selected.read-write with value YES (to allow usage of NSSavePanel) In AppDelegate.m, I implement applicationDidFinishLaunching as follows: -…
phimuemue
  • 34,669
  • 9
  • 84
  • 115
3
votes
1 answer

Swift Mac Os Application - NSSavePanel does not behave correctly with a 'background only' application

I'm developing a swift Mac OS app that works only in the status bar (with a popover) with Application is background only set to true. Inside the popover the user can interact with a button to save an image, more specifically the following function…
madx
  • 6,723
  • 4
  • 55
  • 59
3
votes
1 answer

Completion handler never called for NSSavePanel beginWithCompletionHandler

When I open an NSSavePanel or NSOpenPanel instance with beginWithCompletionHandler: the handler is never called. Instead I see the panel appear for a fraction of a second, before it goes away again without letting the user select a file. When I open…
Mark
  • 1,447
  • 2
  • 14
  • 26
3
votes
1 answer

Customizing sandboxed NSSavePanel alert

I am validating urls from NSSavePanel using the delegate's panel(_:validate) method, throwing error in case of invalid url. In such case the NSSavePanel presents an alert, which I want to customize (meaning present some human readable description)…
3
votes
3 answers

Make NSSavePanel forget the previous directory

NSSavePanel remembers the previous selected directory. How can I make it to forget it, and restore the default value? I'm working with a sandboxed app.
hpique
  • 119,096
  • 131
  • 338
  • 476
2
votes
1 answer

Manipulating an NSSavePanel's accessoryView?

I have an NSSavePanel set up with an accessory view that contains a format popup menu and a tabless tabview with various options regarding the selected format. It shows up on the panel correctly, but I cannot seem to adjust its size. Calling…
John Wells
  • 1,139
  • 1
  • 10
  • 27
2
votes
1 answer

Overriding the list of possible export formats in a NSSaveDialog

I have an application that can load in third party code. One of the capabilities that the third party code can do is add formats in which the app can export to. I am using saveDocumentTo: as means for implementing export. I understand that I can…
Jakub Hampl
  • 39,863
  • 10
  • 77
  • 106
2
votes
1 answer

NSSavePanel - Adding a select menu

I have an app which uses an NSSavePanel. The app is a video editing app, and I need this save panel to display a selection menu for the format of the video. How could I do that ? Here is a simple code: NSSavePanel *mySavePanel = [NSSavePanel…
Alberto
  • 4,212
  • 5
  • 22
  • 36