mardi 5 juillet 2016

How to check UIWebView url link for possible file?


I have implemented a model class called RCHDownload

It has a function to start downloading a file using a String it is called addDownload(url: String)

This function can be used anywhere I want using a singleton called sharedInstance

Now what I want to do is in my UIWebView delegate method

func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {}

I want it to check for possible file before it starts downloading but I am unable to do that so far

I tried checking that using: request.url.isFileURL & request.url.checkResourceIsReachable() with no luck. Any suggestions ?


Aucun commentaire:

Enregistrer un commentaire