美文网首页
iPhone14Pro机型身份证扫描近距离无法对焦适配

iPhone14Pro机型身份证扫描近距离无法对焦适配

作者: 苏打水kesee1 | 来源:发表于2022-11-18 16:37 被阅读0次

最近接连出现iPhone14Pro、iPhone14ProMax近距离拍照十分模糊,无法对焦的问题,问题出在iPhone14Pro机型的最近对焦距离相比上一代机型提高了大概五厘米的距离,会导致身份证扫描或银行卡扫描等检测边框的自定义相机近距离无法识别,解决办法就是对机型做判断,如果是上述机型就不调用默认主摄而是调用广角摄像头,话不多说直接上代码


#import <sys/utsname.h>
#import <sys/stat.h>
    struct utsname systemInfo;
    uname(&systemInfo);
    NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
    AVCaptureDeviceType deviceType = AVCaptureDeviceTypeBuiltInWideAngleCamera;
    if ([deviceModel isEqualToString:@"iPhone15,2"] || [deviceModel isEqualToString:@"iPhone15,3"]) {
        if (@available(iOS 13.0, *)) {
            deviceType = AVCaptureDeviceTypeBuiltInUltraWideCamera;
        }
    } else if ([deviceModel hasPrefix:@"iPhone16,"]) {
        if (@available(iOS 13.0, *)) {
            deviceType = AVCaptureDeviceTypeBuiltInDualWideCamera;
        }
    }

相关文章

网友评论

      本文标题:iPhone14Pro机型身份证扫描近距离无法对焦适配

      本文链接:https://www.haomeiwen.com/subject/rpupxdtx.html