问题
I have a problem in loading in my web view This is my code:
NSString *urlString = @"https://www.google.com.eg";
// NSString *urlString = @"http://fatima.ibtdi.work";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[_fatimaView loadRequest:urlRequest];}
It works on Google but doesn't work on the another link.
回答1:
Looks like you need to add some App Transport Security Settings to your Info plist try this
Any HTTP loading in a web view will require adding the domain to these settings.
回答2:
Add this to your plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
回答3:
You have to add
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
in your info.plist because your link "http://fatima.ibtdi.work" is not secured by SSL, so you have to add NSAppTransportSecurity in your info.plist file. IOS manage the link if the link is secured with SSL certificates else it block transportation from device to web.
Hope this helps you.
来源:https://stackoverflow.com/questions/44285901/cant-load-my-web-view-with-an-http-url