question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mczernekcommented, Nov 19, 2019

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.

1reaction
dean9703111commented, Sep 9, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data on FileSystem.documentDirectory not persisting over ...
iOS will update UUID of directory each time you change your build (ex. different builds on TestFlight or different version on AppStore).
Read more >
App file document directory change… | Apple Developer Forums
My app is saving data to a Realm file on device. It supports multi-languages. But now I found I'm facing a problem: whenever...
Read more >
FileSystem - Expo Documentation
FileSystem. expo-file-system provides access to a file system stored locally on the device. Within Expo Go, each project has a separate file system...
Read more >
[Solved]-iOS app-level communication over USB
It is possible. 'USBMuxConnectByPort' is the function from the private framework MobileDevice.framework See usage example here: ...
Read more >
Use Filesystem - let's read and write the file by react-native-fs ...
DocumentDirectoryPath: absolute path of Document Directory. TemporaryDirectoryPath: absolute path of Temporary Directory. (same with Cache Directory on Android) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found