通常在 [ZXCapture dealloc] 崩溃

usually crash at [ZXCapture dealloc]

我正在使用 zxcapture。我的程序经常在以下代码中指出的特定点崩溃。

- (void)dealloc {
    if (_lastScannedImage) {
        CGImageRelease(_lastScannedImage); // crash here
    }

    if (_session && _session.inputs) {
        for (AVCaptureInput *input in _session.inputs) {
            [_session removeInput:input];
        }
    }

    if (_session && _session.outputs) {
        for (AVCaptureOutput *output in _session.outputs) {
            [_session removeOutput:output];
        }
    }
}

[self.capture.layer removeFromSuperlayer];
[self.capture stop];
[self dismissViewControllerAnimated:YES completion:nil];

解决了问题。