2017-09-12 5 views
0

때 여기반작용 - 기본 - 카메라 오류를 수정 flashMode 속성이 걸릴 사진 수정 flashMode 속성을 가진 사진을 가지고하려고 할 때 나는 다음과 같은 오류를 얻고있다

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

내가 사용하고 코드의 조각입니다 :

<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> 

답변

0

그래서, setState를 두 통화를 제거하는이 오류를 해결 여기

내 걸릴 사진 방법 :

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

이전에는 필자의 takePicture 메서드에서 상태를 두 번 설정했습니다. 방금 외부 setState를 이동하고 오류가 사라졌습니다.

이유는 모르겠지만 지금은 작동 중입니다.

누구든지이 오류에 대한 설명이 있으면 알려 주시기 바랍니다.