Search code examples
swiftwkwebviewrss-reader

-canOpenURL: failed for URL: "about:blank" - error: "This app is not allowed to query for scheme about"


I'm creating a rss reader app and I'm integrating KINWebBrowser but when loaded URL every time it throw a message in title. Code:

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let item = feedItems[indexPath.row] as MWFeedItem
    let url = NSURL(string: item.link)
    let webBrowser = KINWebBrowserViewController()

    webBrowser.loadURL(url)
    self.navigationController?.pushViewController(webBrowser, animated: true)


}

Solution

  • The URL you are trying to open is the string "about:blank", meaning this is an empty page. They error is due to missing URL scheme, which makes the viewcontroller try open the non-existing "about" scheme.

    Best way to solve this is to filter the feedItems array by removing any item that is not a valid URL. If you want show the blank page anyways, add a proper URL scheme like http://about:blank.