swift - NSURLErrorDomain with code=-1100 -
i trying download picture app from
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
Post a Comment