webView on iOS is not accessing some sites

2

I'm trying to develop an application in iOS using the objective-c language. But I have a .metaweb domain that I need it to access is not loading. I noticed that some sites such as facebook , globoesporte , espn does not also load, however google , linkedin , yahoo it accesses. The code I'm using is:

NSURL *url = [NSURL URLWithString:@"http://www.metaweb.com.br"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];

Do you have any idea what might be happening?

    
asked by anonymous 07.10.2015 / 16:31

2 answers

2

iOS 9 by default blocks HTTP connections. To enable them, open the Info.plist file in text mode (right click, Open As / Source Code) and add the following configuration inside the dictionary in the root:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict> 
    
07.10.2015 / 17:27
0

For a Swift solution, I recommend using CSafariWebKit

In your file

import CSafariWebKit

And wherever you want to call WebView

let vc = SafariViewController(url: url, barTintColor: nil, tintColor: nil)
vc.presentSafari(fromViewController: self, whenDidFinish: nil)

Use the colors of your app for a better experience.

    
14.05.2018 / 02:18