mirror of
https://github.com/zoriya/react-native-background-downloader.git
synced 2025-12-06 06:56:10 +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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user