NSOpenPanel runModal崩溃? [英] NSOpenPanel runModal Crashes?
本文介绍了NSOpenPanel runModal崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个例程,基于在这个论坛上找到的代码:
I'm have a routine based on code found on this forum:
+ (FSRef)useOpenFileToGetFSRef:(NSString **)fileName requiredFileType: (NSString*) requiredFileType
{
FSRef fileFSRef;
NSArray* fileTypes = [[NSArray alloc] initWithObjects:requiredFileType, nil];
//http://stackoverflow.com/questions/11815784/objective-c-nsopenpanel-get-filename
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
[openDlg setFloatingPanel:YES];
[openDlg setCanChooseDirectories:NO];
[openDlg setCanChooseFiles:YES];
[openDlg setAllowsMultipleSelection:YES];
[openDlg setAllowedFileTypes:fileTypes];
if ( [openDlg runModal] == NSOKButton ) //<== CRASHES ON CALL TO runModal
{
NSArray* filePaths = [openDlg URLs];
//only getting 1st file
NSURL *fileUrl = [filePaths objectAtIndex:0];
*fileName = [fileUrl path];
CFURLGetFSRef((CFURLRef)fileUrl, &fileFSRef);
}
return fileFSRef;
}
应用程序可重复地对runModel的调用:
The app repeatably crases on the call to runModel:
有什么可以解释这一点吗?
What could explain this?
非常感谢所有的任何信息。
Thanks very much in advance to all for any info.
em>系统信息:OS X 10.8.4。使用ARC编译。
System info: OS X 10.8.4. Compiled using ARC.
推荐答案
我实际上认为你对所有异常都有一个断点。我刚碰到这个,正在寻找为什么。我遇到这个职位,但后来发现了以下。
I actually think you had a breakpoint on all exceptions. I just ran into this and was looking for why. I ran into this post, but then found the following.
当您重新创建项目时,重置。
When you recreated the project, the breakpoints got reset.
这篇关于NSOpenPanel runModal崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文