简体   繁体   中英

UIWebview not load URL in ios9

i want to load url in web view like as

NSString *urlAddress = @"http://ashu007blr.tumblr.com/loadadd";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[self.adWeb loadRequest:requestObj];

but i get error like as

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

i find solution for google then i added NSAppTransportSecurity in my info.plist like as

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

but it is not working i get same error.

Did you do this?

Open your info.plist file like this picture

http://imgur.com/mVvKD1R

And add the following two attributes

  1. NSAppTransportSecurity

  2. NSAllowsArbitraryLoads

Note: 1st one is NSDictionary type and second one is BOOL Type

This occurs for HTTPS connections to servers that don't have the appropriate setup for Perfect Forward Secrecy.

See Apple's Tech Note which lists the requirements.

Our own server https://prod.ly needed a new SSL certificate, namely one with SHA256 signature. It was still using an older, less secure, algorithm.

These are the App Transport Security requirements:

  1. The server must support at least Transport Layer Security (TLS) protocol version 1.2.
  2. Connection ciphers are limited to those that provide forward secrecy (see the list of ciphers below.)
  3. Certificates must be signed using a SHA256 or better signature hash algorithm, with either a 2048 bit or greater RSA key or a 256 bit or greater Elliptic-Curve (ECC) key.
  4. Invalid certificates result in a hard failure and no connection.

These are the accepted ciphers:

  • TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  • TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
  • TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
  • TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
  • TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
  • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
  • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA

PS: You can check your server's suitability for ATS/PFC with the SSL Labs checker page: eg https://www.ssllabs.com/ssltest/analyze.html?d=api.productlayer.com

PPS: Your original URL might be HTTP, but there are several resources referenced from the HTML that comes back that are accessed via HTTPS, eg https://secure.assets.tumblr.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM