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

2022-11-18  本文已影响0人  苏打水kesee1

最近接连出现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;
        }
    }

上一篇 下一篇

猜你喜欢

热点阅读