mirror of
https://github.com/zoriya/react-native-background-downloader.git
synced 2026-06-02 10:05:13 +00:00
ios: fix "Error when sending event: downloadBegin"
This commit is contained in:
@@ -353,11 +353,13 @@ RCT_EXPORT_METHOD(completeHandler:(nonnull NSString *)jobId
|
||||
if (taskCofig != nil) {
|
||||
if (!taskCofig.reportedBegin) {
|
||||
NSDictionary *responseHeaders = ((NSHTTPURLResponse *)downloadTask.response).allHeaderFields;
|
||||
[self sendEventWithName:@"downloadBegin" body:@{
|
||||
@"id": taskCofig.id,
|
||||
@"expectedBytes": [NSNumber numberWithLongLong: totalBytesExpectedToWrite],
|
||||
@"headers": responseHeaders
|
||||
}];
|
||||
if (self.bridge) {
|
||||
[self sendEventWithName:@"downloadBegin" body:@{
|
||||
@"id": taskCofig.id,
|
||||
@"expectedBytes": [NSNumber numberWithLongLong: totalBytesExpectedToWrite],
|
||||
@"headers": responseHeaders
|
||||
}];
|
||||
}
|
||||
taskCofig.reportedBegin = YES;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-background-downloader",
|
||||
"version": "2.4.1",
|
||||
"version": "2.4.2",
|
||||
"description": "A library for React-Native to help you download large files on iOS and Android both in the foreground and most importantly in the background.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user