NSOpenPanel crashes when debugging with Xcode 4.5.1

孤人 提交于 2019-12-07 18:50:15

问题


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):

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

Thanks a lot.


回答1:


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.



来源:https://stackoverflow.com/questions/12979323/nsopenpanel-crashes-when-debugging-with-xcode-4-5-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!