所以这是我的问题:我创建了一个自定义的 AVCaptureSession 来拍照。我不知道为什么,但你第三次打电话startRunning
,它崩溃了。我实现didReceiveMemoryWarning
了,它在崩溃之前没有被调用。我还在上面运行了仪器,并且没有与 AVCaptureSession 相关的内存泄漏。XCode 中的控制台也没有日志。
所以我的问题是......即使didReceiveMemoryWarning
没有被调用,这是否是内存问题?这是我的一些代码。
viewWillDisappear (视图控制器)
- (void)viewWillDisappear:(BOOL)animated {
if (cameraFlashButton) { [cameraFlashButton release]; }
if (switchCamera) { [switchCamera release]; }
if (cameraBadgeBack) { [cameraBadgeBack release]; }
if (cameraBadgeNumber) { [cameraBadgeNumber release]; }
if (cameraUseButton) { [cameraUseButton release]; }
if (cameraOverlayView) { [cameraOverlayView release]; }
if (blackOverlay) { [blackOverlay release]; }
if (loadingIndicator) { [loadingIndicator release]; }
if (cameraPickButton) { [cameraPickButton release]; }
if (whiteOverlay) { [whiteOverlay release]; }
if (imageOverlay) { [imageOverlay release]; }
if (captureManager) { [captureManager release], captureManager = nil; }
if (theCaptureSession) { [theCaptureSession release], theCaptureSession = nil; }
[super viewWillDisappear:YES];
}
解除分配(CaptureSessionManager)
- (void)dealloc {
if ([self captureSession]) { [[self captureSession] stopRunning]; }
if (previewLayer) { [previewLayer release], previewLayer = nil; }
if (captureSession) { [captureSession release], captureSession = nil; }
if (stillImageOutput) { [stillImageOutput release], stillImageOutput = nil; }
if (stillImage) { [stillImage release], stillImage = nil; }
[super dealloc];
}
想法?如果您需要查看其他内容,请询问!提前致谢。