How to accept self-signed certificate with asihttprequest

前端 未结 1 1865
迷失自我
迷失自我 2021-02-14 17:08

I am trying to get a self-signed certificate to work with my application.

I am using the ASIHTTPRequest library at the moment like so :

- (IBAction)sendH         


        
相关标签:
1条回答
  • 2021-02-14 17:38

    I have set setValidatesSecureCertificate to YES in the hope that something would happen but obviously nothing has because I'm not sure what I have to do.

    This is the problem. It defaults to YES and you need to set it to NO. As your certificate is self-signed, iOS can't validate the certificate - there is no trusted authority in the system that has signed the certificate, so it has no basis for saying that it is valid. So if you ask it to validate the certificate (which is the default), it has to reject it. You have to disable certificate validation to get self-signed certificates to work.

    0 讨论(0)
提交回复
热议问题