Check NSURL for UTI / file type
This should work:
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
for (NSURL *url in urls) {
NSString *type;
NSError *error;
if ([url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:&error]) {
if ([workspace type:type conformsToType:@"public.movie"]) {
// the URL points to a movie; do stuff here
}
} else {
// handle error
}
}
(You can also use UTTypeConformsTo()
instead of the NSWorkspace
method.)