xCode IOS UIWebView HTTP content being blocked by IOS 9

My code was working just fine with IOS 7 and IOS 8 but with IOS 9 the UIWebView displays the remote content as blank.

iPhone code:
    NSURL *page1 = [NSURL URLWithString:@"http://www.liveaboardfleet.net/app/pages/2.0/iPhone/17/index.html"];
    NSURLRequest *page1Request = [NSURLRequest requestWithURL:page1];
    [_page1 loadRequest:page1Request];
    _page1.scalesPageToFit = YES;

Open in new window


iPad code:
    NSURL *page1 = [NSURL URLWithString:@"http://www.liveaboardfleet.net/app/pages/2.0/iPad/page0017.html"];
    NSURLRequest *page1Request = [NSURLRequest requestWithURL:page1];
    [_page1 loadRequest:page1Request];
    _page1.scalesPageToFit = YES;

Open in new window


The UIWebView works fine on my iPad running IOS 7 but it's blank on my iPhone 5C running IOS 9.1
LVL 7
Robert SaylorSenior DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert SaylorSenior DeveloperAuthor Commented:
The issue is because my remote content is HTTP and not HTTPS

I need help disabling the HTTPS requirement with IOS 9. IOS 9 is blocking HTTP content
0
Robert SaylorSenior DeveloperAuthor Commented:
If I use this:
    NSURL *page1 = [NSURL URLWithString:@"https://www.google.com"];

Then google loads on the UIWebView

If I use this:
NSURL *page1 = [NSURL URLWithString:@"https://gis.liveaboardfleet.com/gis/test.html"];

The webview is blank

I am very confused at this point.
0
Robert SaylorSenior DeveloperAuthor Commented:
I added this to get an error log:

- (void)page2:(UIWebView *)page2 didFailLoadWithError:(NSError *)error
{
    NSLog(@"Error : %@",error);
}

Open in new window


2015-11-19 10:00:49.392 LiveAboard[6180:867394] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

I found the fix:

Open appname.plist and add an exception for the domain hosting the remote content:

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>www.liveaboardfleet.net</key>
            <dict>
                <!--Include to allow subdomains-->
                <key>NSIncludesSubdomains</key>
                <true/>
                <!--Include to allow HTTP requests-->
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <!--Include to specify minimum TLS version-->
                <key>NSTemporaryExceptionMinimumTLSVersion</key>
                <string>TLSv1.1</string>
            </dict>
        </dict>
    </dict>

Open in new window

0
Robert SaylorSenior DeveloperAuthor Commented:
I started using WIX for some of my remote content and they don't support SSL yet. I found the plist update did not work for WIX content so I found this one will work:

<key>NSAppTransportSecurity</key>
<dict>
    <!--Connect to anything (this is probably BAD)-->
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Open in new window


However, I don't know if that will get my app rejected or not. If it does we will have to move away from WIX and use something that supports SSL.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert SaylorSenior DeveloperAuthor Commented:
tested to work on iPhone 5C with IOS 9
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
iOS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.