diff --git a/ios/RNBackgroundDownloader.m b/ios/RNBackgroundDownloader.m index 7fd79129..c06e423f 100644 --- a/ios/RNBackgroundDownloader.m +++ b/ios/RNBackgroundDownloader.m @@ -116,7 +116,6 @@ + (void)setCompletionHandlerWithIdentifier: (NSString *)identifier completionHan NSLog(@"[RNBackgroundDownloader] - [Error] id, url and destination must be set"); return; } - [self lazyInitSession]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]]; if (headers != nil) { @@ -126,6 +125,7 @@ + (void)setCompletionHandlerWithIdentifier: (NSString *)identifier completionHan } @synchronized (sharedLock) { + [self lazyInitSession]; NSURLSessionDownloadTask __strong *task = [urlSession downloadTaskWithRequest:request]; RNBGDTaskConfig *taskConfig = [[RNBGDTaskConfig alloc] initWithDictionary: @{@"id": identifier, @"destination": destination}];