Skip to content

[AVCaptureDevice setTorchMode:] The passed torchMode 1 is not supported - use -isTorchModeSupported: to discover valid torch modes #167

@YangPeiqiu

Description

@YangPeiqiu

设备不支持闪光灯,例如ipad设备,需要在闪光灯打开的代码部分先做判断

  • (void)setTorch:(BOOL)torch {

    [self.input.device lockForConfiguration:nil];
    if ([self.input.device hasTorch]) {
    self.input.device.torchMode = torch ? AVCaptureTorchModeOn : AVCaptureTorchModeOff;
    }
    [self.input.device unlockForConfiguration];
    }
    此处是否应该要这样支持下呢?目前没有的

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions