2017-09-12 3 views
0

ich die folgende Störung erhalte, wenn sie versuchen flashMode Attribut zu nehmen Foto mit Änderung:Reagieren Native-Kamera Fehler beim nimmt Foto mit modifizierten flashMode Attribute

{ NSLocalizedDescription: 'Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x170440210 {Error Domain=NSOSStatusErrorDomain Code=-16800 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16800), NSLocalizedDescription=The operation could not be completed}' } } 2017-09-12 00:08:29.907053-0300 GimenesApp[1936:765074] { [Error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x170440210 {Error Domain=NSOSStatusErrorDomain Code=-16800 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16800), NSLocalizedDescription=The operation could not be completed}]

Hier wird das Stück Code, das ich verwende:

<Camera 
    captureTarget={Camera.constants.CaptureTarget.disk} 
    ref={(cam) => { 
     this.camera = cam; 
    }} 
    flashMode={this.state.flashMode}> 
    <Button onPress={this.takePicture.bind(this)} transparent 
     <Icon name="ios-radio-button-off" /> 
    </Button> 
</Camera> 

Antwort

0

So löste ich diesen Fehler zwei Anrufe zu entfernen, ist zu SetState

Hier mein nehmen Foto-Methode:

takePicture() { 
    const options = {}; 
    this.camera.capture({metadata: options}) 
     .then((data) => { 
     this.setState({ 
      PHOTO_PATH: data.path, 
      IS_NOT_PHOTO_TAKE: false 
     }); 
     }) 
     .catch(err => { 
     console.error(err) 
     }); 
    }; 

Vorher habe ich den Status zweimal in meiner takePicture-Methode festgelegt. Ich habe gerade den outside setState verschoben und der Fehler ist weg.

Ich weiß nicht warum, aber jetzt, es funktioniert.

Wenn jemand eine Erklärung zu diesem Fehler haben, bitte teilen Sie mit uns.

Verwandte Themen