检测文件属性(图片,视频或文本)

    NSString *file = @"http://192.168.119.222:8090/shzhserver/media/dcb289f1-d5d8-4fcd-a8eb-5ec10838d38f.mp4";

    DLog(@"%@", [file pathExtension]);

    CFStringRef fileExtension = (CFStringRef) [file pathExtension];

    CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);

    

    if (UTTypeConformsTo(fileUTI, kUTTypeImage)) NSLog(@"It's an image");

    else if (UTTypeConformsTo(fileUTI, kUTTypeMovie)) NSLog(@"It's a movie");

    else if (UTTypeConformsTo(fileUTI, kUTTypeText)) NSLog(@"It's text");

    

 

    CFRelease(fileUTI);

你可能感兴趣的:(iPhone不能分类的)