2017-09-12 51 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,錯誤消失了。

我不知道爲什麼,但現在,它正在工作。

如果有人對此錯誤有解釋,請與我們分享。