`progress` dose no work in iOS because`setProgress` will call before `sendRequest`
See original GitHub issueWhen I fetch a file like that:
FetchBlob
.fetch('GET','xxx')
.progress({ interval : 250},(receive,total)=>{
console.log("progress", receive/total)
})
I can’t receive progress because progress
will be called synchronization with fetch
.
In iOS:
fetch
will call :
RCT_EXPORT_METHOD(fetchBlob:(NSDictionary *)options
taskId:(NSString *)taskId
method:(NSString *)method
url:(NSString *)url
headers:(NSDictionary *)headers
body:(NSString *)body callback:(RCTResponseSenderBlock)callback)
progress
will call:
RCT_EXPORT_METHOD(enableProgressReport:(NSString *)taskId interval:(nonnull NSNumber*)interval count:(nonnull NSNumber*)count)
The fetchBlob
function will async create an request obj.
Before the buildOctetRequest
's onComplete
is called ,enableProgressReport
has already been called.
Caused enableProgressReport
can’t find taskID
RCT_EXPORT_METHOD(fetchBlob:(NSDictionary *)options
taskId:(NSString *)taskId
method:(NSString *)method
url:(NSString *)url
headers:(NSDictionary *)headers
body:(NSString *)body callback:(RCTResponseSenderBlock)callback)
{
[RNFetchBlobReqBuilder buildOctetRequest:options
taskId:taskId
method:method
url:url
headers:headers
body:body
onComplete:^(NSURLRequest *req, long bodyLength)
{
// something went wrong when building the request body
if(req == nil)
{
callback(@[@"RNFetchBlob.fetchBlob failed to create request body"]);
}
// send HTTP request
else
{
[[RNFetchBlobNetwork sharedInstance] sendRequest:options
contentLength:bodyLength
bridge:self.bridge
taskId:taskId
withRequest:req
callback:callback];
}
}];
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top Results From Across the Web
Apple logo with progress bar after updating or restoring ...
When this occurs, the progress bar might be moving very slowly or seem like it isn't moving. Let the device complete the update,...
Read more >ASIHTTPRequest does not update progress - Stack Overflow
I use ASIHTTPRequest to upload a file of json with encoded image (or [request setFile:imagefile...]), but I cannot update the progress.
Read more >Troubleshoot OneDrive for iOS app problems - Microsoft Support
Learn how to resolve issues with the OneDrive mobile app.
Read more >Share your real-time location with others - Google Maps Help
Location Sharing works even when Location History is turned off. ... On your iPhone or iPad, open the Google Maps app Maps ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have to do like this
PR is merged