Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

bug: UIApplication methods are called on background thread #486

Merged
merged 1 commit into from
Aug 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ios/RNFetchBlobNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,11 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
[task resume];

// network status indicator
if([[options objectForKey:CONFIG_INDICATOR] boolValue] == YES)
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
if ([[options objectForKey:CONFIG_INDICATOR] boolValue] == YES) {
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
});
}
__block UIApplication * app = [UIApplication sharedApplication];

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

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
});

if(respInfo == nil)
{
Expand Down