swift - NSURLErrorDomain with code=-1100 -


i trying download picture app from

enter image description here request failed error nsurlerrordomain , code -1100. url should correct since checked in browser. knows why?

let userimageurl: string! = "http://i.imgur.com/qhczqor.jpg"; let url = nsurl(fileurlwithpath: userimageurl); let request:nsurlrequest = nsurlrequest(url: url!) nsurlconnection.sendasynchronousrequest(request, queue: nsoperationqueue.mainqueue(), completionhandler: { (response:nsurlresponse!, imagedata:nsdata!, error:nserror!) -> void in                 let image = uiimage(data: imagedata!);  }) 

the reason getting problem because have used

let url = nsurl(fileurlwithpath: userimageurl); 

instead should use:

let url = nsurl(string: userimageurl) 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -