Skip to content

Commit 6ab9ba0

Browse files
Ignigenawkh237
authored andcommitted
prevent UIApplication methods from being called on background thread (wkh237#486)
1 parent 67649da commit 6ab9ba0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ios/RNFetchBlobNetwork.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,11 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
245245
[task resume];
246246

247247
// network status indicator
248-
if([[options objectForKey:CONFIG_INDICATOR] boolValue] == YES)
249-
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
248+
if ([[options objectForKey:CONFIG_INDICATOR] boolValue] == YES) {
249+
dispatch_async(dispatch_get_main_queue(), ^{
250+
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
251+
});
252+
}
250253
__block UIApplication * app = [UIApplication sharedApplication];
251254

252255
}
@@ -483,7 +486,9 @@ - (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCom
483486
NSString * respStr = [NSNull null];
484487
NSString * rnfbRespType = @"";
485488

486-
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
489+
dispatch_async(dispatch_get_main_queue(), ^{
490+
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
491+
});
487492

488493
if(respInfo == nil)
489494
{

0 commit comments

Comments
 (0)