I've seen various methods for checking whether the returned media type in -imagePickerController:didFinishPickingMediaWithInfo:
is video. For example, my way:
- (void)imagePickerController:(UIImagePickerController *)imagePicker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
if (UTTypeEqual(kUTTypeMovie,
(__bridge CFStringRef)[info objectForKey:UIImagePickerControllerMediaType]))
{
// ...
}
}
or
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
or
if ([mediaType isEqualToString:(NSString *)kUTTypeVideo] ||
[mediaType isEqualToString:(NSString *)kUTTypeMovie])
or
if (CFStringCompare ((__bridge CFStringRef) mediaType, kUTTypeMovie, 0)
== kCFCompareEqualTo)
or
if ([mediaType isEqualToString:@"public.movie"]
Everyone seems to have a different way of doing this. What's the recommended method for checking the media type? Preferably with a way to include "all image types" or "all video types".