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
0
votes
1 answer

Saving NSTextViewData to RTF doc

Trying to export NSTextView data to an RTF doc. My old code, mainly "filename" from NSSavePanel is depreciated. The docs state "use URL". How can I do this? Thanks. NSSavePanel *panel = [NSSavePanel savePanel]; [panel…
user1198008
  • 101
  • 1
  • 9
0
votes
1 answer

NSAlert Over NSSavePanel

i am new in objective c , i want create alert over save panel to get confirm from user to overwrite exist file or not , like text editor when you save a file in a directory that have same file name alert show over save panel that ask to replace or…
Kosar
  • 170
  • 2
  • 13
0
votes
0 answers

How to remove escaped characters from a path returned by NSSavePanel::url::path?

I'm using the following to let a user pick a file to save in my macOS app: let panel = NSSavePanel() let resp = panel.runModal() if(resp == .OK) { let strFilePath = panel.url?.path(); } The problem is that NSSavePanel::url::path escapes spaces…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
0
votes
1 answer

Getting permission to write multiple files on macOS

I have a Swift program that helps organise cat shows. It generates several rtf files and an xml file, which should be saved into one folder on disk, and only have minor modifications to their file names - the first one could be named 'Cat show.rtf',…
0
votes
1 answer

NSSavePanel, CGImageDestinationFinalize and OS X sandbox

I'm using NSSavePanel to let user select image to save to in my app. Everything worked fine until I enabled app sandboxing and entitlements. The problem occurs with selection of an already existing file. My code is like this: // Create a URL to our…
Alexander B
  • 407
  • 2
  • 17
0
votes
0 answers

"+[CATransaction synchronize] called within transaction" with NSSavePanel

Starting with macOS Ventura (or maybe with the latest Xcode version), I'm getting log messages in my Mac app: +[CATransaction synchronize] called within transaction whenever the app displays an NSSavePanel (or subclass). For instance: …
jeanlain
  • 382
  • 1
  • 3
  • 13
0
votes
1 answer

Weird behavior when using SwiftUI View as accessory view for NSSavePanel

I'm trying to use a view written in SwiftUI as an accessory view of my NSSavePanel but I struggled to get it working properly. Here's the implementation for my SwiftUI view: struct ExportAccessoryView: View { enum ExportFileType: String,…
AgentBilly
  • 756
  • 5
  • 20
0
votes
0 answers

Trying to save a .txt file not working as I would expect

I have a function that uses an NSSavePanel to get a URL to save a text file report. I'm trying to check to see if the resulting url ends in ".txt" and if it does, great. If it doesn't I am trying to add the ".txt" extension. However what happens is…
psb
  • 89
  • 5
0
votes
2 answers

NSSavePanel issues

I am semi-new to cocoa programming, however I have worked quite a bit in C++; I am having some issues with the NSSavePanel class. Whenever I use it (as shown below), I can see (by using breakpoints) that the code tries to execute the ending bracket.…
0
votes
1 answer

How can I hide the save panel when I'm using a NSDocument

So I'm trying to play around with WebKit and create my own browser. However, now I'm kind of stuck where I can't hide the save panel when I try to close my window. I can't find any method in the NSDocument reference that hides the panel. Does…
TheAmateurProgrammer
  • 9,252
  • 8
  • 52
  • 71
0
votes
1 answer

NSOpenPanel, NSSavePanel runModal dismisses immediately with cancel, but only on M1 running 11.4

I have one user who reports that the Open and Save panels have been "auto dismissing". ie the Open Panel dialog appears then immediately dismisses itself, taking the "cancel" path through the code The file Open menu item is the standard…
greg
  • 309
  • 1
  • 7
0
votes
1 answer

NSDocument-Based Application: Selecting Default File Type in NSSavePanel

I'm playing with the NSDocument class to make a simple document-based application. My info.plist contains four document content type identifiers including public.text, public.plain-text, public.source-cde, public.rtf as shown above. And I get…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
0
votes
1 answer

Xamarin.Mac cannot write files when Sandbox is enabled

I'm making a file encryption app, but when I submit it to the App Store, if I don't enable Sandbox, it gets rejected when I upload it with Transporter.app. So, I added Sandbox to Entitlements.plist as follows.
hibara
  • 137
  • 11
0
votes
0 answers

NSSavePanel initialization throws Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0) on

I'm working on a flutter package for all 6 Platforms and now I'd like to open a Save As dialog (I'm total amateur in Swift), so I'm getting an exception when Initializing the object of NSSavePanel, I tried multiple ways, the most basic was let panel…
Hassan Ansari
  • 318
  • 1
  • 3
  • 11
0
votes
3 answers

Should I call NSSavePanel runModal method only from main thread?

I have weird, though rare, crashes in my application. I suspect that it happens because runModal of NSSavePanel is called in a thread different from the main thread. Am I correct that it might be the cause for the crashes?
Erik Sapir
  • 23,209
  • 28
  • 81
  • 141