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.

IOS save to path results in no file

See original GitHub issue

Upon upgrading from 0.10.13 to 0.10.14, saving to a specified file on IOS has stopped working.

let fullPath = RNFetchBlob.fs.dirs.DocumentDir + '/test.txt';
let res = await RNFetchBlob
  .config({ path: fullPath })
  .fetch('GET', 'https://raw.githubusercontent.com/joltup/rn-fetch-blob/master/.gitignore');
console.warn(fullPath);
console.warn(res.path());
console.warn(res.info());

Under both versions, the first two logs give the same result (something like [...]/Library/Developer/CoreSimulator/Devices/F3CE7938-1974-467C-8183-C1F98AC74CCE/data/Containers/Data/Application/8F3721D5-7CC6-4CEC-8D96-1AB6B4CB26E6/Documents/test.txt) and the last yields an object with the appropriate information (including status: 200).

If I navigate to [...]/Documents/ folder when the app is built with 0.10.13, text.txt exists. However, under 0.10.14, the folder remains empty.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:19
  • Comments:20

github_iconTop GitHub Comments

11reactions
vitorverasmcommented, Feb 26, 2019

I’m in RN 0.57 and rn-fetch-blob 0.10.15. So when i try to download directly to a file with path: it returns response.path() correctly but there’s no file. I don’t know if i’m doing something wrong 😞 . I’m saving at DocumentDir on iOS.

EDIT: i’ve solved this by using WRITE_EXTERNAL_STORAGE permission on Android. And using this keys in info.plist for iOS:

<key> UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>

As described here, to enable file sharing in the app Document folder.

6reactions
JofBigHealthcommented, Dec 14, 2018

Reverting to 0.10.13 fixes it and works perfectly for both operating systems for us.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Saved file is gone after recompiling the App - Stack Overflow
Save to NSUserDefaults only the relative path from the Documents Directory (what you append to the getDocumentsURL() NSURL ). So in your case,...
Read more >
Use the Files app on your iPhone, iPad, or iPod touch
In the Files app, search or browse for the file that you want. iPhone search results for WIP, the name of a folder...
Read more >
Writing data to the documents directory - a free Hacking with iOS
– and it's that all iOS apps are sandboxed, which means they run in their own container with a hard to guess directory...
Read more >
Add third-party apps to the Files app on iOS - Microsoft Support
The files you save to the Files app on your iOS device show up automatically, but you'll need to set up other third-party...
Read more >
How to save artwork in Illustrator - Adobe Support
Learn about saving your artwork files in Adobe Illustrator. ... Select Preserve Paths to discard transparency effects and reset transparent ...
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