将项目内的图像保存到设备本地

问题描述

enter image description here

这是我保存的代码,不能在发布模式下运行,而是在调试模式下运行,在转换后,我的uri似乎无效。

 if (result['android.permission.WRITE_EXTERNAL_STORAGE']) {
    const exampleImageUri = 
    Image.resolveAssetSource(this.props.images[this.props.currIndex].uriBK).uri;
    RNFS.downloadFile({
      fromUrl: exampleImageUri,toFile: imagePath,})
      .promise.then(() => {
        this.setState({ source: { uri: imagePath } });
        showMessage({
          message: 'Đã lưu',type: 'success',animated: true,backgroundColor: '#015cd0',textStyle: {
            fontFamily: 'OpenSans-Regular',textAlign: 'center',},});
      })
      .catch(e => console.log('e: ',e));

这是uri在转换调试后找到但释放后找不到 http:// localhost:8081 / assets / assets / images / 22.png?platform = android&hash = c94e41e671e252c60449ebd5d490ba74

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)