Timeout when showing NSSavePanel
Asked Answered
P

2

6

When showing an NSSavePanel while the app is in background I get the following error:

RVS:__54-[NSRemoteSavePanel _runOrderingOperationWithContext:]_block_invoke_0319 : Timeout occured while waiting for the window
Remote Window Controller requested NSRequestRetryActivateSharedwindow...

Also, the panel doesn't appear and runModal returns NSFileHandlingPanelCancelButton.

The app is sandboxed. This is the code that creates the panel:

NSSavePanel *panel = [NSSavePanel savePanel];
NSInteger result = [panel runModal];
if (result == NSFileHandlingPanelOKButton)
{
    // Do something
}

What might be the problem?

If the app is in the foreground the panel is shown without any error.

Prewitt answered 27/12, 2012 at 19:32 Comment(11)
damn ^^ this is hard... mhm not in a block... in main thread? I guess so... WHEN do you call this?Spokane
Main thread. I already checked in the debugger, just in case.Prewitt
yip and WHEN? before appWilllFinishLaunching - from inside awakeFromNib?Spokane
Gets called in a delegate method of the app delegate, after a long-running background operation finishes. The method is called in the main thread.Prewitt
and do you somehow block the main thread after the call somehow -- so that the window cannot be shown? some sleep ^^ or for(i<1000000000) or some calculation?Spokane
Nope. I only call stopAnimation on a progress indicator before, but I removed that to test and it still fails.Prewitt
and after the call to runModal?Spokane
There's nothing after the beginWithCompletionHandler: call.Prewitt
Clarified that the app is sandboxed. Also simplified the example, as the problem can be also reproduced with runModal.Prewitt
are you running something else modal? or does the runloop not run by any chance?Spokane
Nope. The only "odd" thing is that it only happens when the app is not in the foreground.Prewitt
C
6

Be sure to enable the appropriate entitlements. In this case, check that "User Selected File" is not set to "No Access".

Clay answered 28/12, 2012 at 22:46 Comment(1)
It's set to Read/Write access.Prewitt
B
1

For the "User selected file" entitlement of the Entitlement section from Summary tab of target setting should be set to "Read/Write" access.

Brinkmanship answered 19/3, 2013 at 11:10 Comment(2)
The questioner already said that it is set to read/write. #14060714Darken
Sorry Peter Hosey, I did not observe. Even i had faced same issue, By setting "Read/Write" access its been resolvedBrinkmanship

© 2022 - 2024 — McMap. All rights reserved.