I am using Cocoa with Obj C. I am using NSOpenPanel for selecting the file and getting the file name. For restricting the files to "XML" I am using the following code: Code: NSArray* types = [NSArray arrayWithObject:@"xml"]; NSOpenPanel *oPanel = [NSOpenPanel openPanel]; [oPanel setAllowsMultipleSelection:NO]; [oPanel setCanChooseDirectories:NO]; [oPanel setCanChooseFiles:YES]; [oPanel setAllowedFileTypes:types]; But still I am able to select other file types too. From the hierarchy of NSOpenPanel, its parent is NSSavePanel which is having the method "setAllowedFileTypes". I must be able to use this method as NSOpenPanel will derive the methods of parent. Please suggest me some good way to solve the problem.