1

below NSURLSessiondelegate function supporting only https receive challenge.

func URLSession(session: NSURLSession, didReceiveChallenge challenge: NSURLAuthenticationChallenge, completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void)

In Info.plist , I included below stuff to allow all connections:

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

to support http as well but the NSURLSession Delegate is not triggering at all.

NSURLSession - How to support http authentication challenge? Also it will useful if its workable to Kingfisher 3rd party framework too.

Bhavin Ramani
  • 3,221
  • 5
  • 30
  • 41
Lion
  • 872
  • 1
  • 17
  • 43
  • Maybe you need to provide the auth param in request header instead? – Tj3n Dec 20 '16 at 05:16
  • @Tj3n could you please elaborate – Lion Dec 20 '16 at 05:17
  • Have you test your api with postman? It have authorization tab which contains several auth type, maybe u can provide the auth beforehand, try [this](http://stackoverflow.com/questions/21105322/ios-cocoa-nsurlsession-handling-basic-https-authorization) – Tj3n Dec 20 '16 at 05:21

0 Answers0