Ver código fonte

Network activity calls on main thread

Artur Chrusciel 6 anos atrás
pai
commit
89d9b7a5a7
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6
    2
      ios/RNFetchBlobRequest.m

+ 6
- 2
ios/RNFetchBlobRequest.m Ver arquivo

@@ -162,7 +162,9 @@ typedef NS_ENUM(NSUInteger, ResponseFormat) {
162 162
     
163 163
     // network status indicator
164 164
     if ([[options objectForKey:CONFIG_INDICATOR] boolValue]) {
165
-        [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
165
+        dispatch_async(dispatch_get_main_queue(), ^{
166
+            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
167
+        });
166 168
     }
167 169
 }
168 170
 
@@ -367,7 +369,9 @@ typedef NS_ENUM(NSUInteger, ResponseFormat) {
367 369
     NSString * respStr;
368 370
     NSString * rnfbRespType;
369 371
     
370
-    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
372
+    dispatch_async(dispatch_get_main_queue(), ^{
373
+        [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
374
+    });
371 375
     
372 376
     if (error) {
373 377
         errMsg = [error localizedDescription];