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;
}
The app repeatably crases on the call to runModel:
What could explain this?
Thanks very much in advance to all for any info.
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.
NSOpenPanel crashes when debugging with Xcode 4.5.1
When you recreated the project, the breakpoints got reset.