Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSOpenPanel crashes when debugging with Xcode 4.5.1

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.

like image 623
Dirk Avatar asked Apr 18 '26 23:04

Dirk


1 Answers

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.

like image 68
Dirk Avatar answered Apr 21 '26 02:04

Dirk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!