I am code in Objective-C, it is easy to convert it to Swift (a small modification actually, but the explanation is not so much related to the code). If you check the error message, you will receive:
= NSURLErrorDomain Code = -1100 " URL ." UserInfo = 0x7997b7e0 {NSErrorFailingURLStringKey = :///HTTP:/i.imgur.com/QhCzQoR.jpg, NSErrorFailingURLKey = :///HTTP:/i.imgur.com/QhCzQoR.jpg, NSLocalizedDescription = URL server., NSUnderlyingError = 0x799f3080 " URL ." }
, URL-, file:///http:/i.imgur.com/QhCzQoR.jpg, URL-. url.absoluteString, URL-, :
? fileURLWithPath: URLWithString:.
:
let url = NSURL(URLWithString: userImageURL);
:
URLWithString URLWithPath NSURL?
doc.