Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSURLConnection Error Code -1100

Tags:

xcode

ios

swift

I am trying to load content into UIWebView, and when testing in the simulator all I get is a white screen and the following error in the console:

NSURLConnection finished with error - code -1100  

Can anybody help? My current Swift Code is:

class ViewController: UIViewController {  
    @IBOutlet weak var webView: UIWebView!  

    override func viewDidLoad() {  
        super.viewDidLoad()  

        webView.allowsInlineMediaPlayback = true;         
        webView.mediaPlaybackRequiresUserAction = false;  

        webView.loadRequest(URLRequest(url: URL(fileURLWithPath: Bundle.main.path(forResource: "www/index", ofType: "html")!)))  

        let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView  
        statusBar?.backgroundColor = UIColor.clear  

    }  
}  

Just to clarify, this code usual works for me, but I can't find anything online relating to error -1100. Many thanks.

like image 444
user1391152 Avatar asked Sep 26 '17 14:09

user1391152


1 Answers

-1100 means NSURLErrorFileDoesNotExist. And you are accessing a local file, print the URL's absoluteString to check the path is good for that file.

like image 95
Yun CHEN Avatar answered Nov 04 '22 16:11

Yun CHEN