使うとき
NSArray* fileTypes = [[NSArray alloc] initWithObjects:@"pdf", @"PDF", nil];
NSInteger result = [openPanel runModalForTypes:fileTypes];
期待どおりに動作します(PDFファイルのみを選択できます)が、
NSArray* fileTypes = [[NSArray alloc] initWithObjects:@"pdf", @"PDF", nil];
[openPanel setAllowedFileTypes:fileTypes];
NSInteger result = [openPanel runModal];
PDFだけでなく、すべての種類のファイルを選択できます。ドキュメントには、runModalForTypesは非推奨であり、2番目の方法を使用する必要があると記載されています。私は何か間違ったことをしていますか?