NSOpenPanel and setAllowedFileTypes

Joined
Dec 4, 2012
Messages
2
Reaction score
0
System: 10.8.2
Compiling for: 10.6
XCode : 4.5.2

I am having problems with "setAllowedFileTypes" on an NSOpenPanel

The documentations says that you can pass an array of file extensions or UTI's.
I am wanting to open files that have either a "cct" extension or a file type of "CDIF". I verified the UTI by dumping it out using the following code.

theUTIDictionary=(NSDictionary *)UTTypeCopyDeclaration((CFStringRef) uti);

theEnum=[theUTIDictionary keyEnumerator];

for (NSString *s in theEnum)
{
NSLog(@"key is %@, value is %@",s, [theUTIDictionary objectForKey: s]);
}

It contains the appropriate entries for both the extension and the file type.

When I run the App it does not allow me to select files with the old file type of "CDIF". Yes , I have verified that the file does have that type(GetFileInfo in Terminal). Any idea's.

Thanks

Neil
 
Joined
Nov 26, 2010
Messages
3,540
Reaction score
51
I know Apple likes us to use UTI's but I'm still using extensions.

[myOpenPanel setAllowedFileTypes:[NSArray arrayWithObjects:mad:"cct", @"CDIF", nil]];
 
Joined
Dec 4, 2012
Messages
2
Reaction score
0
I know Apple likes us to use UTI's but I'm still using extensions.

[myOpenPanel setAllowedFileTypes:[NSArray arrayWithObjects:mad:"cct", @"CDIF", nil]];

Thanks for the prompt reply. What you suggest will work for files with extensions but how about files with the old "File Type"? That is why I used UTI's , I thought I could use one method to handle both cases.

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top