Use untrusted certificate of server api call in swift iOS

 Problem:

I want to call api with untrusted certificate using alomafire swift.


Solution:


        if let cook = Sessions().getCookie() {

            HTTPCookieStorage.shared.setCookie(cook)

        }

         let session: Session = {

                let manager = ServerTrustManager(evaluators: ["192.168.1.15"DisabledTrustEvaluator()])

                let configuration = URLSessionConfiguration.af.default

                return Session(configuration: configuration, serverTrustManager: manager)

            }()



Instead of af.request use session.request ....


Happy coding..

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift