Question

When I use Sandboxing in a Mac app, I click a menu item "export", it should open a dialog using NSOpenPanel, but it does not. Here's the code I have:

[playExportPanel beginSheetModalForWindow:mainWindow
                        completionHandler: ^(NSInteger result) {
     if(result == NSFileHandlingPanelOKButton) {
             ....
     }
}]

It throws an exception: -[NSRemoteOpenPanel close]: unrecognized selector sent to instance. What is NSRemoteOpenPanel? Has anyone seen this before?

Was it helpful?

Solution

I just fixed this issue in my own app. I removed the [sheet close];. Then I replaced it with [sheet orderOut:self]; later. The latter may not be necessary in your case. In my code an error sheet may be displayed from the block code before it returns. This would cause stacked sheets, which I don’t like having in this constellation: it looks cluttered.

You probably migrated to “-beginSheetModalForWindow:completionHandler:” form the deprecated API and reused your older code. Even though the call to -close is removed the panel is closed after the block returns. This is probably part of the behavior of the new API, but I have yet to find that described in the documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top