反应native:Error:Location .....不可移动

时间:2019-03-12 10:05:09

标签: react-native filesystems expo

我已经录制了一些音频文件,然后我试图将这些音频文件移动到folder.in的默认路径,这时出现错误,例如错误:Location'''file:///data/data/host.exp。 exponent / cache / ExperienceData /%40Fanonymous%2FCCameraApplication / filename.3gp'''不可移动。 如果有人遇到同样的问题,请告诉我。 但我的默认路径是:file:///data/data/host.exp.exponent/cache/ExperienceData/%2540anonymous%252FCCameraApplication/filename.3gp

在这里附上我的示例代码。

const info = await FileSystem.getInfoAsync(this.recording.getURI());
    console.log(`FILE INFO: ${JSON.stringify(info)}`);
    const currentTime=Date.now();
    await FileSystem.moveAsync({
      from: `${JSON.stringify(info.uri)}`,
      to: `${FileSystem.documentDirectory}audios/${currentTime}.3gp`,
    });

1 个答案:

答案 0 :(得分:0)

Expo的FileSystem模块可以复制/移动/等。以前保存在应用程序范围内的文件(例如,通过ImagePicker或使用Asset.loadAsync)。 ImagerEditor是React Native的核心功能,它将您的图像保存到Expo范围之外的文件中,因此FileSystem无法对该文件执行操作。现在更清楚了吗?

更多信息:https://forums.expo.io/t/where-does-camera-takepictureasync-save-photos/6475/7