AVAssetWriter error: Cannot append media data after ending session
问题 This error occurs when capturing video with AVAssetWriter . However, after calling AVAssetWriter's finishWriting inside of endVideoCapture , there isn't another call to start writing again, so why is this occurring? As you can see in the delegate function, captureOutput , we check the recording state before trying to append to the asset writer. The recording state is set to false in endVideoCapture. Optional(Error Domain=AVFoundationErrorDomain Code=-11862 "Cannot append media data after