我在尝试使用FlashMode属性修改照片时会遇到以下错误:
{nslocalizedDescription:'错误域= avFoundationRordomain 代码= -11800"无法完成操作" userInfo = {nsunderlyingerror = 0x170440210 {错误 domain = nsosstatusorrordomain code = -16800"(null)"}, nslocalizedfailurereason =发生未知错误(-16800), nslocalizedDescription =无法完成操作}'}}} 2017-09-12 00:08:29.907053-0300 gimenesapp [1936:765074] {[错误: 错误域= avFoundationRordomain code = -11800"操作可以 未完成" domain = nsosstatusorrordomain code = -16800"(null)"}, nslocalizedfailurereason =发生未知错误(-16800), nslocalizedDescription =无法完成操作}]
这是我使用的代码:
<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>
所以,我解决了此错误,删除了两个呼叫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)
});
};
以前,我用分子方法设置了两次状态。我只是移动了外部设置,并且错误消失了。
我不知道为什么,但是现在,它正在起作用。
如果有人对此错误有解释,请与我们分享。