[iPhone Dev] Camera Swap
// Button Event -( IBAction )CameraSwap:( id )sender { NSArray *Current_inputs = self . _captureSession . inputs ; for ( AVCaptureDeviceInput *old_input in Current_inputs) { AVCaptureDevice *device = old_input. device ; if ([device hasMediaType : AVMediaTypeVideo ]) { AVCaptureDevicePosition position = device. position ; AVCaptureDevice *newCamera = nil ; AVCaptureDeviceInput *newInput = nil ; if (position == AVCaptureDevicePositionFront ) { newCamera = [ self cameraWithPosition : AVCaptureDevicePositionBack ]; } else { newCamera = [ self cameraWithPosition : AVCaptureDevicePositionFront ]; } newInput = [ AVCaptureDeviceInput deviceInputWithDevice :newCamera error : nil ]; // Config Start [ self . _captureSession beginConfiguration ]; [ self . _captureSession removeInput