2

I'm a newbie on IOS development. Recently, I use UIWebView to load a webpage, and this is successful, and try to open links in it on the same UIWebView instance. However, after a click on some link, there's no response from UIWebView, and in xcode, it reports

2015-03-29 23:42:07.246 xxxxx[17349:1251340] Unknown result for URL http://www.xxxxxx.org/bugs/xxxxxx-xxxx-xxxxxx, for frame

I looked it up on Internet but I got little useful help. I know someone said to implement func webView in UIWebViewDelegate, but my app still doesn't work.

Can someone help me? I'm using the latest version of swift language. And a snippet of code is :

 import UIKit

class ViewController: UIViewController, UIWebViewDelegate {

    @IBOutlet weak var front: UIWebView!

    func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType nt: UIWebViewNavigationType) -> Bool {

    if (nt ==.LinkClicked){
        return true
    }
    return true;
}

override func viewDidLoad() {
    super.viewDidLoad()
    UIWebView.loadRequest(self.front)(NSURLRequest(URL: NSURL(string: "http://www.google.com")!))        // 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.
}

}

alex
  • 21
  • 3

1 Answers1

0

Here is the sample Code :

UIWebView.loadRequest(webviewInstance)(NSURLRequest(URL: NSURL(string: "www.google.in")))
Ajumal
  • 1,048
  • 11
  • 33
  • Hi Aju,I know that. I have already successfully loaded the original webpage. But in that page, there're some links and I also want to open them in the same UIWebView instance. The question I came across is that there's no response after I clicked any of the links on that web page. I want to know how can I have UIWebView to open those links. – alex Mar 30 '15 at 07:30