Transport application security violates web view

My app that works great under iOS8 no longer works under iOS9. The problem is that although my .plist file has the following:

<key>NSAppTransportSecurity</key>
<dict>
   <!--Include to allow all connections (DANGER)-->
   <key>NSAllowsArbitraryLoads</key>
   <true/>
</dict>

The following code:

NSURL *targetURL = [NSURL URLWithString:_caseStudyListTitleURL];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[_myWebView loadRequest:request];

results in an error:
NSURLSession / NSURLConnection HTTP load error (kCFStreamErrorDomainSSL, -9813)

This, of course, results in an empty webView being displayed.

All other NSURLSession codes in the application function correctly.

I am running Xcode 7 Beta 3 and iOS 9 on my test iPad.

Any ideas on this would be greatly appreciated!

+4
source share
2 answers

Try this solution:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>yourdomain.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
        </dict>
    </dict>
</dict>
+2
source

, , . iOS https-.

- , .

:

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{

//code to cancel authentication challenge

}

, , HTTPS-url WebView.

.

0

All Articles