I'm having some problems using NSOpenPanel. I have an open file dialog, which I want to only display/select files of a given type. If I use runModalForTypes everything works just fine. However, this function is deprecated and setAllowedFileTypes & runModal should be used instead. Using the new functions though does not work (all files are displayed rather than only the allowed types) and I can't figure out why. Can anyone please enlighten me?
Here's the code:
I tried also setting setAllowsOtherFileTypes:NO, but this had no effect.
Thanks for any help!
Here's the code:
Code:
NSOpenPanel* openDlg = [ NSOpenPanel openPanel ];
NSArray* fileTypes = [ NSArray arrayWithObject:@"obj" ];
[ openDlg setAllowedFileTypes:fileTypes ]; // DOES NOT WORK
[ openDlg runModal ];
[ openDlg runModalForTypes:fileTypes ]; // WORKS
I tried also setting setAllowsOtherFileTypes:NO, but this had no effect.
Thanks for any help!