Execute the following code
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.bing.com"]]];
WebView didFailLoadWithError:(UIWebView *)webView didFailLoadWithError:(NSError *)error printed as follows
1 [6587:75627] NSURLConnection finished with error - code -1022 2 [6587:75574] Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy 3 requires the use of a secure connection." UserInfo={NSUnderlyingError=0x600000641f50 4 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires 5 the use of a secure connection." UserInfo={NSErrorFailingURLStringKey=http://www.bing.com/, 6 NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., 7 NSErrorFailingURLKey=http://www.bing.com/}}, NSErrorFailingURLStringKey=http://www.bing.com/, NSErrorFailingURLKey=http://www.bing.com/, 8 NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
The solution is simple:
URLString must use HTTPS to request the WebView to display properly
But then I found out that I had to load http://localhost:8080 and then, sadly, I’m going to have to look at the mechanics, and in XCode 9 I’m going to get an error message that’s pretty obvious
The resource could not be loaded because the App Transport Security policy
Go to Baidu ATS Policy, you can know the answer in detail, in SupportFiles-> Info.plist file to add the following attributes, there is a direct option, do not need to fill out
done!
Reproduced in: https://www.cnblogs.com/zhouhui231/p/8572705.html
Read More:
- Error domain = nsurlerrordomain code = – 1001 “request timeout occurred in swift alamofire get request. ” UserInfo={NSUnderlyingErro
- Flask Request an extension before_request after_request errorhandler
- IOS WebView failed to load the web page. Error domain = kcferrodomaincfnetwork code = 310 “there was a problem communicating with the secure web proxy server (HTTPS). “
- IIS “Bad Request – Request Too Long. HTTP Error 400. The size of the request headers is too long.”
- In the HTML page request Ajax times 400 error, solve Yii submit post form 400 error, and Ajax post request 400 problem (example code)
- Bad Request – Request Too Long. HTTP Error 400. The size of the request headers is too long
- [nodejs] error request aborted after request routing in post mode
- request:fail url not in domain list or Cannot send network request to localhost
- Nginx modifies the front end request size limit (413 request entity too large)
- React Native Network Request Failed solution
- Error: request failed with status code 500
- NuxtSe rverError:Request failed With status code 500 my solution and thinking
- Asynchronous Future Parallel processing request code example
- Springboot project: error parsing HTTP request header note: further occurrences of HTTP request parsing
- PaddlePaddle:Process finished with exit code -1073741819 (0xC0000005)
- Error inflating class in WebView in Android 5. X android.webkit.WebView Solutions
- Vue failed to log in. F12 reported an error: request failed with status code 404
- Finished with error: Gradle task assembleDebug failed with exit code 1
- Error in v-on handler (Promise/async): “Error: Request failed with status code 500“
- IOS development NSURLSession/NSURLConnection HTTP load failed solution