FileSystem.documentDirectory changes between TestFlight and App Store version
See original GitHub issue🐛 Bug Report
The FileSystem.documentDirectory changes when switching between TestFlight and App Store app versions for a published iOS app. Practically, this means that images saved in the file system whose URIs are stored in AsyncStorage are now gone, because the saved URIs are not accessible.
Environment
This bug happens in a standalone iOS app.
Expo diagnostics:
Expo CLI 2.17.0 environment info:
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
Shell: 5.4.2 - /usr/bin/zsh
Binaries:
Node: 10.14.1 - /opt/node/bin/node
Yarn: 1.12.3 - /usr/bin/yarn
npm: 6.4.1 - /opt/node/bin/npm
npmPackages:
@types/expo: ^31.0.3 => 31.0.4
@types/react: ^16.7.17 => 16.7.18
@types/react-native: ^0.57.19 => 0.57.22
expo: ^31.0.4 => 31.0.6
react: 16.5.0 => 16.5.0
react-native: https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz => 0.57.1
Steps to Reproduce
You can just console.log(FileSystem.documentDirectory)
to observe that it changes when switching between TestFlight and App Store versions.
Expected Behavior
I’d expect that versions of an app that share the same AsyncStorage share the same FileSystem.documentDirectory.
Actual Behavior
The FileSystem.documentDirectory changes every time you switch between TestFlight and App Store versions, so if you switch, then anything you saved to the documentDirectory is not accessible anymore.
Reproducible Demo
This snack demonstrates the problem, but you’d need a fully deployed app to actually see it happen. If anyone is interested, I can add you to the TestFlight for my actual app, Pottery Log, and provide instructions to reproduce the problem from there.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
I guess that the real solution to this problem is storing relative path rather than absolute. We cannot change behavior of iOS system itself, which does not guarantee paths to be persistent between builds.
Upate filesystem in ios will update Directory in every update version. But your file is still exsits in folder. you just use relative path replace absolute path.