Reputation: 4409
How to give multiple check condition in NSPredicate
[NSPredicate predicateWithFormat:@"SELF ENDSWITH %@ %@%@ ,doc,pdf,png];
it need to work and give me three type and give me output.
Upvotes: 1
Views: 115
Reputation: 1328
Try this....
NSArray *ext = [NSArray arrayWithObjects:@"doc", @"pdf", @"png", nil];
NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirPath error:nil];
NSArray *files = [dirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"pathExtension IN %@", ext]];
Upvotes: 1