[英]How to determine if image captured using UIImagePickerController is JPEG or HEIF?
I have set the imageExportPreset property of the UIImagePickerController to use current. 我已经将UIImagePickerController的imageExportPreset属性设置为使用current。 How can I determine if the image captured is HEIF or JPEG? 如何确定捕获的图像是HEIF还是JPEG?
Did you try something like the following? 您是否尝试过以下方法?
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSURL *assetURL = info[UIImagePickerControllerReferenceURL];
NSString *extension = [assetURL pathExtension];
CFStringRef imageUTI = (UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,(__bridge CFStringRef)extension , NULL));
if (UTTypeConformsTo(imageUTI, kUTTypeJPEG))
{
// JPEG
}
else
{
NSLog(@"Unhandled Image UTI: %@", imageUTI);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.