I always used UIWebView without troubles until I wanted to load a new URL. With the code below, the second url will not be loaded for some reason. Can you find why? (The plist has the exceptions for the domains!)
let webview = UIWebView()
webview.frame = CGRectMake(0, 0, view.bounds.width, view.bounds.height )
view.addSubview(webview)
var url = NSURL (string: "http://google.com")
var requestObj = NSURLRequest(URL: url!,
cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData,
timeoutInterval: 10.0)
webview.loadRequest(requestObj)
webview.reload()
//Wait 5 seconds to load another page
let time = dispatch_time(dispatch_time_t(DISPATCH_TIME_NOW), 5 * Int64(NSEC_PER_SEC))
dispatch_after(time, dispatch_get_main_queue()) {
url = NSURL (string: "http://yahoo.com")
requestObj = NSURLRequest(URL: url!,
cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData,
timeoutInterval: 10.0)
webview.loadRequest(requestObj)
webview.reload()
}