why sdwebimage can't download image while my api works fine with https?

968 views Asked by At

I check my server with :

nscurl --verbose --ats-diagnostics https://xxx

It shows my server only supports TLSV1.0, but my API works fine and I can get my JSON data with it .

When I get my image URL with JSON data to load my image by SDWebImage,it shows

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9801)

So, I'm confused, If my server doesn't support the minimum TLS version, why does my API work? Otherwise, if my server is ok, why does XCode show that kCFStreamErrorDomainSSL wrong?

My image URL is also similar:

https://xxx.xxxxx.xxx/xxx.jpg
1

There are 1 answers

3
Aman Gupta On

In the info.plist of your project, you need to add a key "Add Transport Security Settings" which is a dictionary and contains a variable "Allow Arbitrary Loads" which is boolean and is set to true.

<key>NSAppTransportSecurity</key>
<dict> 
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

info.plist