I am making a simple webview
using Swift 3
. But after run am getting only the blank screen.
It is not opening the link which I put in url request.
import UIKit
class ViewController: UIViewController {
@IBOutlet var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL (string: "http://www.google.net");
let request = URLRequest(url: url!);
webView.loadRequest(request);
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
try this it might help..
write this code in info.plist
and write this code in viewdid load
You have to set the
NSAllowsArbitraryLoads
key toYES
underNSAppTransportSecurity
dictionary in your .plist file.Like this Image: