[英]Cocoa app crashes when trying to open a save dialog: Timeout occured while waiting for the window
I wrote an HTML5 app and I'm making a wrapper for it in Cocoa for the Mac. 我写了一个HTML5应用程序,并在Mac的Cocoa中为其包装。 I'm in the process of writing a method that will take a url and let the user save it to their disk. 我正在编写一种方法,该方法将使用url并让用户将其保存到磁盘上。 Here is the method so far: 到目前为止,这是方法:
- (void) downloadFile: (NSString *) url {
NSSavePanel * savePanel = [NSSavePanel savePanel];
[savePanel setAllowedFileTypes: @[@"png"]];
[savePanel setNameFieldStringValue:@"test"];
[savePanel beginWithCompletionHandler:^(NSInteger result){
//NSArray * files = [[openDlg URLs] valueForKey: @"relativePath"];
//[resultListener chooseFilenames: files] ;
}];
[savePanel runModal];
}
However when I invoke the method (long after the window is made) my app crashes and I get this error in the console: 2013-07-21 18:23:05.067 Reditr[31458:d11f] RVS:__54-[NSRemoteSavePanel _runOrderingOperationWithContext:]_block_invoke_0319 : Timeout occured while waiting for the window 但是,当我调用该方法(在创建窗口很长时间之后)时,我的应用程序崩溃,并且在控制台中收到以下错误:2013-07-21 18:23:05.067 Reditr [31458:d11f] RVS:__ 54- [NSRemoteSavePanel _runOrderingOperationWithContext: ] _block_invoke_0319:等待窗口时发生超时
You don't want to use both -runModal
and -beginWithCompletionHandler:
. 您不想同时使用-runModal
和-beginWithCompletionHandler:
Use one or the other (preferably the latter). 使用其中一个(最好是后者)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.