Ios 通常在[ZXCapture dealloc]时崩溃

Ios 通常在[ZXCapture dealloc]时崩溃,ios,crash,zxing,Ios,Crash,Zxing,我正在使用zxcapture。我的程序经常在下面代码中指出的特定点崩溃 - (void)dealloc { if (_lastScannedImage) { CGImageRelease(_lastScannedImage); // crash here } if (_session && _session.inputs) { for (AVCaptureInput *input in _session.inputs) {

我正在使用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];
[自我捕捉停止];

[自我解除视图控制器激活:是完成:无]是否有错误消息?是的,错误就像在Deal中的EXC_BAD_ACESS找到了答案@让我试试,然后我将回答问题是否解决。捕获层应从视图中删除。此外,捕获会话应在关闭之前停止。