Sfoglia il codice sorgente

fix(WKWebView): Add "Frame load interrupted" error handling for OAuth (#147)

José Luis Pereira 5 anni fa
parent
commit
6f612242fe
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7
    0
      ios/RNCWKWebView.m

+ 7
- 0
ios/RNCWKWebView.m Vedi File

@@ -466,6 +466,13 @@ static NSString *const MessageHanderName = @"ReactNative";
466 466
       return;
467 467
     }
468 468
 
469
+    if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102) {
470
+      // Error code 102 "Frame load interrupted" is raised by the WKWebView
471
+      // when the URL is from an http redirect. This is a common pattern when
472
+      // implementing OAuth with a WebView.
473
+      return;
474
+    }
475
+
469 476
     NSMutableDictionary<NSString *, id> *event = [self baseEvent];
470 477
     [event addEntriesFromDictionary:@{
471 478
       @"didFailProvisionalNavigation": @YES,