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

[Quick fix] iOS Release network requests not completing #722

Closed
teodorciuraru opened this issue Apr 5, 2021 · 0 comments
Closed

[Quick fix] iOS Release network requests not completing #722

teodorciuraru opened this issue Apr 5, 2021 · 0 comments

Comments

@teodorciuraru
Copy link

teodorciuraru commented Apr 5, 2021

Dependencies

"react": "16.13.1",
"react-native": "0.63.4",
"rn-fetch-blob": "^0.12.0"

Problem

Network task fails to complete in Release mode (iOS) and seem to be blocking here, where self.task becomes nil and [nil resume] is called.

...
self.task = [session dataTaskWithRequest:req];
[self.task resume]; // self.task = nil

Workaround

Avoiding self.task makes the network requests work again, so we suspect a problem around it.

// self.task = [session dataTaskWithRequest:req];
// [self.task resume];
[[session dataTaskWithRequest:req] resume];

Proposal
Kindly select an option that works for both of us so a PR can be submitted:

  1. Avoid using the self.task property altogether. (probably not possible because it's used on cancelRequest)
  2. Should the task be declared weak? Declare self.task as strong.
  3. Postponing assignment:
NSURLSessionDataTask *task = [session dataTaskWithRequest:req];
[task resume];
self.task = task;

Work will be started immediately after response, because this issue is critical to us.

Edit: Submitted option 3 as a PR, cause it looks the least intrusive and would really help.

@teodorciuraru teodorciuraru changed the title iOS Release network requests not completing [Quick fix] iOS Release network requests not completing Apr 12, 2021
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

No branches or pull requests

1 participant