fix error caused by `bytesWritten` is null
fix error caused by `bytesWritten` is null
This commit is contained in:
parent
ce98cba66f
commit
65ab7914b3
|
@ -160,9 +160,12 @@ RCT_EXPORT_METHOD(downloadFile:(NSString *)urlStr
|
|||
params.toFile = filepath;
|
||||
|
||||
params.callback = ^(NSNumber* statusCode, NSNumber* bytesWritten) {
|
||||
return callback(@[[NSNull null], @{@"jobId": jobId,
|
||||
@"statusCode": statusCode,
|
||||
@"bytesWritten": bytesWritten}]);
|
||||
NSMutableDictionary* result = [[NSMutableDictionary alloc] initWithDictionary: @{@"jobId": jobId,
|
||||
@"statusCode": statusCode}];
|
||||
if (bytesWritten) {
|
||||
[result setObject:@"bytesWritten" forKey: bytesWritten];
|
||||
}
|
||||
return callback(@[[NSNull null], result]);
|
||||
};
|
||||
|
||||
params.errorCallback = ^(NSError* error) {
|
||||
|
|
Loading…
Reference in New Issue