Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually flush & invalidate session upon completion #938

Closed
wants to merge 2 commits into from
Closed

Manually flush & invalidate session upon completion #938

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 5, 2020

Our application downloads ~1000 items from an API ranging from sizes of 2mb - 100mb, while doing so on iOS14 the device regularly returned error 28 - no space left on device

We raised an issue (#937) and while investigating a fix we discovered that this error doesn't always mean the literal – https://github.com/AFNetworking/AFNetworking/issues/4313#issuecomment-437216801

Since the library creates a new instance of Downloader per file download we've come to a conclusion that iOS14 doesn't flush the URLSessions quick enough when they're complete so we've added this manually.

@ghost ghost mentioned this pull request Oct 12, 2020
Aliveing added a commit to Aliveing/react-native-fs that referenced this pull request Nov 6, 2020
@n-sviridenko
Copy link
Contributor

Any updates on this? We'd love it to be delivered as we're facing the same issue now.

@joshuaellis
Copy link

I wouldn't count on it, the last update on the repo was march 2020, meanwhile we're all running the latest version which was released oct 2019. I submitted this PR last year and haven't heard anything, not even a request for changes.

@n-sviridenko
Copy link
Contributor

n-sviridenko commented Jan 5, 2021

how did you solve it at the end?

@joshuaellis
Copy link

The code I wrote was a fix we used in our applicaiton. Hence why I submitted a PR.

@n-sviridenko
Copy link
Contributor

Thanks for your commitment @joshuaellis ! Let us try this one too.

@mataspetrikas
Copy link

@joshuaellis @n-sviridenko I have tried compiling it but XCode 12.3 complains:
No visible @interface for 'NSURLSession' declares the selector 'flushWithCompletitonHandler:'

@n-sviridenko
Copy link
Contributor

Fixed this in #972

@n-sviridenko
Copy link
Contributor

@itinance we need you 🦸‍♂️

@itinance
Copy link
Owner

Thank you very much guys. I'm going to close this in favour of #972. Many thanks anyways!

@itinance itinance closed this Feb 28, 2021
@itinance
Copy link
Owner

(and sorry for being late here, this year was going to start very crazy)

@nijarv
Copy link

nijarv commented Oct 9, 2023

Hey guys, any help??? I use react-native-fs(2.20.0) and I'm still facing this issue when I download images and videos even though I have gb's of space left in my device I get "The operation couldn’t be completed. No space left on device".

iPhone Version : iPhone 12 Mini
iOS Version : iOS 17.0.3
Mac Version : MacBook Pro 13-inch, M1, 2020
Mac OS Version : Sonoma 14.0
Xcode Version : 15.0
NPM Version : 2.20.9
react : 18.2.0
react-native : 0.71.10

Code:

let path = RNFS.DocumentDirectoryPath + '/image.png';

RNFS.downloadFile({ fromUrl: eachTemplate.uri, toFile: path }).promise.then((resp) => {
                if (resp.statusCode === 200)
                  setImagePath(path);
              }).catch((err) => {
                console.log(err);
              });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants