Skip to content

Commit 89d9b7a

Browse files
author
Artur Chrusciel
committed
Network activity calls on main thread
1 parent f6fae9b commit 89d9b7a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ios/RNFetchBlobRequest.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
162162

163163
// network status indicator
164164
if ([[options objectForKey:CONFIG_INDICATOR] boolValue]) {
165-
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
165+
dispatch_async(dispatch_get_main_queue(), ^{
166+
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
167+
});
166168
}
167169
}
168170

@@ -367,7 +369,9 @@ - (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCom
367369
NSString * respStr;
368370
NSString * rnfbRespType;
369371

370-
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
372+
dispatch_async(dispatch_get_main_queue(), ^{
373+
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
374+
});
371375

372376
if (error) {
373377
errMsg = [error localizedDescription];

0 commit comments

Comments
 (0)