2014-06-12 6 views
5

Utrzymuje on daje mi błąd:Error Code AVFoundationErrorDomain Domain = -11814 = "Nie można nagrywać"

Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record"

Nie jestem pewien, na czym polega problem? Próbuję nagrać dźwięk w prawo, gdy licznik osiągnie 1 po zrobieniu zdjęcia.

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]; 
} 


} 
+3

Czy to było za pomocą symulatora? –

+0

@MarkMcCorkle, gotcha! –

+0

Tak, to było za pomocą symulatora! – Akbapu

Odpowiedz

2

Ten błąd jest z powodu korzystania z emulatora, trzeba używać urządzenia

Pozdrowienia

+1

Uruchamianie na urządzeniu daje mi ten dokładny błąd ... – pojomx

+0

Uruchamianie na urządzeniu naprawiono to dla mnie – Akbapu

1

Mając urządzenie ograniczyć dostęp do aparatu pod „Ustawienia> Ogólne> Ograniczenia” również daje to błąd.

Powiązane problemy