In several of my projects I am using the following code:

NSOpenPanel * ProfilOpenPanel = [NSOpenPanel openPanel];
[ProfilOpenPanel setCanChooseFiles:YES];
[ProfilOpenPanel setCanChooseDirectories:NO];
[ProfilOpenPanel setAllowsMultipleSelection:YES];
[ProfilOpenPanel setAllowedFileTypes:[NSArray arrayWithObject:@"txt"]];
int antwort=[ProfilOpenPanel runModal];

Since upgrading to 10.8 and Xcode4.5, this code doesn’t work any more. The panel opens, but then the app crashes with a message in the Debug Navigator as: quicklook.pluginload(serial) 1 Thread Thread 5 14 _pthread_wqthread

In the console, a couple of warnings appear: WindowServer: CGXDeferSurfaces: Invalid source window 19938 and another warning: 28.September.12 12:10:40.001 Xcode[78227]: [MT] DVTAssertions: Warning in /SourceCache/IDEKit/IDEKit-1854/Framework/Classes/Editor/IDEEditorContext.m:617 Details: Lost history for x-xcode-disassembly://stack_frame? processID=31774&threadID=12&frameID=0 Object: Method: -_greatestDocumentAncestorWasForgotten Thread: {name = (null), num = 1} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

有帮助吗?

解决方案

Disabling my exception breakpoint in xcode worked for me. Or try just disabling all breakpoints.

Source: answer to the same poster on a blog at http://cyborgdino.com/2012/02/nsopenpanel-displaying-a-file-open-dialog-in-os-x-10-7/#comment-702

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top