错误域= AVFoundationErrorDomain代码= -11814“无法记录"; [英] Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record"
本文介绍了错误域= AVFoundationErrorDomain代码= -11814“无法记录";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
它不断给我错误:
Error Domain = AVFoundationErrorDomain代码= -11814无法记录"
Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record"
我不确定是什么问题?我正在尝试在拍照后计数器达到1时记录声音.
I am not sure what the problem is? I am trying to record the sound right when the counter reaches 1 after a picture is taken.
static int counter;
//counter will always be zero it think unless it is assigned.
if (counter == 0){
dispatch_async([self sessionQueue], ^{
// Update the orientation on the still image output video connection before capturing.
[[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] videoOrientation]];
// Flash set to Auto for Still Capture
[AVCamViewController setFlashMode:AVCaptureFlashModeAuto forDevice:[[self videoDeviceInput] device]];
// Capture a still image.
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (imageDataSampleBuffer)
{//[AVCaptureSession snapStillImage];
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
[[[ALAssetsLibrary alloc] init] writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:nil];
}
NSLog(@"i");
}];
});
if (!_audioRecorder.recording)
{
//start recording as part of still image
_playButton.enabled = NO;
_stopButton.enabled = YES;
[_audioRecorder record];
for(int i=0;i<1000;i++)
{
//do nothing just counting
}
//stop the recording
}
}
else if (counter == 1)
{
[self recordForDuration:5];
}
}
推荐答案
此错误是因为使用仿真器,需要使用设备
This error is because you use an emulator, you need use an device
致谢
这篇关于错误域= AVFoundationErrorDomain代码= -11814“无法记录";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文