DevNotes icon indicating copy to clipboard operation
DevNotes copied to clipboard

你的demo如果录制视频点击几次屏幕后会崩溃,reason: '*** -[AVAssetWriter finishWritingWithCompletionHandler:] Cannot call method when status is 2'

Open xinyu1105 opened this issue 6 years ago • 0 comments

  • (void)stopWritingWithError:(NSError **)error {

self.isWriting = NO;

dispatch_async(self.dispatchQueue, ^{

[self.assetWriter finishWritingWithCompletionHandler:^{
	
	if (self.assetWriter.status == AVAssetWriterStatusCompleted) {
		
		dispatch_async(dispatch_get_main_queue(), ^{
			if ([self.delegate respondsToSelector:@selector(videoWriter:didOutputVideoAtPath:)]) {
				[self.delegate videoWriter:self didOutputVideoAtPath:self.assetWriter.outputURL];
			}
		});
		
	} else {
		
		*error = self.assetWriter.error;
		
	}
    self.assetWriter = nil;
}];

}); }

这个怎么解决呢?麻烦回复下,谢谢!!

xinyu1105 avatar May 08 '18 06:05 xinyu1105