Question

I have a document-based application. Since upgrading to XCode 4.5.1 (from 4.4) NSOpenPanel crashes when I debug the application from Xcode. It does not crash when I start the program directly.

I use NSOpenPanel on two occasions: When the user selects "Open" from the "File" menu (since it is a document-based application, none of my own code is involved) and for importing some data into my document (so it gets called by my own code). NSOpenPanel crashes on both occasions (the dialog opens, but before I can do anything, an exception is raised).

I made clean, tried switching compiler from Apple LLVM to LLVM GCC and debugger from LLDB to GDB and back, but no change.

This is my code for import:

long result;
NSArray *fileTypes = [NSArray arrayWithObjects: @"txt", @"csv", @"text",
                      NSFileTypeForHFSTypeCode( 'TEXT' ), nil];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];

[oPanel setAllowsMultipleSelection:NO];
[oPanel setAllowedFileTypes:fileTypes];
[oPanel setMessage:@"Please select import file:"];

result = [oPanel runModal];

It seems to crash somewhere during CodeSigning checks (my application isn't code signed):

stack trace

Do I have to set up a new project? Any help is appreciated...

Thanks a lot.

Was it helpful?

Solution

I found the reason: I had a breakpoint set on "All Exceptions". When I disable it or select "Automatically continue after evaluating" it works. I guess it is related to App Sandbox.

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