diff --git a/modules/videoio/src/cap_ios_abstract_camera.mm b/modules/videoio/src/cap_ios_abstract_camera.mm index 1ded46a99..565807ccc 100644 --- a/modules/videoio/src/cap_ios_abstract_camera.mm +++ b/modules/videoio/src/cap_ios_abstract_camera.mm @@ -193,6 +193,13 @@ // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; + for (AVCaptureInput *input in self.captureSession.inputs) { + [self.captureSession removeInput:input]; + } + + for (AVCaptureOutput *output in self.captureSession.outputs) { + [self.captureSession removeOutput:output]; + } [self.captureSession stopRunning]; self.captureSession = nil;