This repository was archived by the owner on Oct 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,15 +96,25 @@ - (void)webView:(WKWebView*)theWebView didFailNavigation:(WKNavigation*)navigati
9696 } else {
9797 // Default implementation of didFailNavigation method of CDVWKWebViewEngine.m
9898 CDVViewController* vc = (CDVViewController*)self.viewController ;
99+ #ifndef __CORDOVA_6_0_0
100+ [CDVUserAgentUtil releaseLock: vc.userAgentLockToken];
101+ #endif
102+
99103 NSString * message = [NSString stringWithFormat: @" Failed to load webpage with error: %@ " , [error localizedDescription ]];
100104 NSLog (@" %@ " , message);
101- [CDVUserAgentUtil releaseLock: vc.userAgentLockToken];
105+
102106 NSURL * errorUrl = vc.errorURL ;
103107 if (errorUrl) {
104- errorUrl = [NSURL URLWithString: [NSString stringWithFormat: @" ?error=%@ " , [message stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]] relativeToURL: errorUrl];
108+ NSCharacterSet *charSet = [NSCharacterSet URLFragmentAllowedCharacterSet ];
109+ errorUrl = [NSURL URLWithString: [NSString stringWithFormat: @" ?error=%@ " , [message stringByAddingPercentEncodingWithAllowedCharacters: charSet]] relativeToURL: errorUrl];
105110 NSLog (@" %@ " , [errorUrl absoluteString ]);
106111 [theWebView loadRequest: [NSURLRequest requestWithURL: errorUrl]];
107112 }
113+ #ifdef DEBUG
114+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle: [[NSBundle mainBundle ] objectForInfoDictionaryKey: @" CFBundleDisplayName" ] message: message preferredStyle: UIAlertControllerStyleAlert];
115+ [alertController addAction: [UIAlertAction actionWithTitle: NSLocalizedString(@" OK" , nil ) style: UIAlertActionStyleDefault handler: nil ]];
116+ [vc presentViewController: alertController animated: YES completion: nil ];
117+ #endif
108118 }
109119}
110120
You can’t perform that action at this time.
0 commit comments