Browse Source

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

José Luis Pereira 6 years ago
parent
commit
6f612242fe
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      ios/RNCWKWebView.m

+ 7
- 0
ios/RNCWKWebView.m View File

466
       return;
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
     NSMutableDictionary<NSString *, id> *event = [self baseEvent];
476
     NSMutableDictionary<NSString *, id> *event = [self baseEvent];
470
     [event addEntriesFromDictionary:@{
477
     [event addEntriesFromDictionary:@{
471
       @"didFailProvisionalNavigation": @YES,
478
       @"didFailProvisionalNavigation": @YES,