iOS Error Code=-1003 "A server with the specified hostname could not be found." : <p>I am trying to load image from URL on the iphone, image is there and I can open it in safari with same link, but not in the app:</p>

<pre><code>Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname 
could not be found." UserInfo={NSUnderlyingError=0x17024f810 
{Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" 
UserInfo={_kCFStreamErrorCodeKey=50331647, _kCFStreamErrorDomainKey=6147928288}},
 NSErrorFailingURLStringKey=https://........, NSErrorFailingURLKey=https://.........
</code></pre>

<p>Code of request:</p>

<pre><code>func downloadImage(userEmail: String, onCompletion: @escaping (UIImage) -&gt; Void) {
    print("Download Started")
    let route = "\(baseURL as String)\(userEmail as String)\(baseURLparameters as String)"
    let url = URL(string: route)

    getDataFromUrl(url: url!) { (data, response, error)  in
        guard let data = data, error == nil else {
            print("===failed:", error ?? "dunno")
            print("===url:", url?.absoluteString ?? "dunno")
            return
        }
        print(response?.suggestedFilename ?? url!.lastPathComponent )
        print("Download Finished")
        DispatchQueue.main.async() { () -&gt; Void in
            onCompletion(UIImage(data: data)!)
        }
    }

}
</code></pre>
