문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top