Merge pull request #45 from magicismight/master
fix error caused by when `bytesWritten` is null
This commit is contained in:
commit
8ef4fa1f65
|
@ -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