Kaynağa Gözat

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

José Luis Pereira 5 yıl önce
ebeveyn
işleme
6f612242fe
1 değiştirilmiş dosya ile 7 ekleme ve 0 silme
  1. 7
    0
      ios/RNCWKWebView.m

+ 7
- 0
ios/RNCWKWebView.m Dosyayı Görüntüle

@@ -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,