I want to allow invalid SSL certificates with AFNetworking

前端 未结 13 691
南笙
南笙 2020-12-02 10:11

I want to allow invalid SSL certificates. My main code is below:

myClient = [[MyClient alloc] init];
[myClient getHtml:@\"/path/to/the/distination.html\"];
<         


        
13条回答
  •  醉梦人生
    2020-12-02 10:46

    I encountered the same problem and no one of the solutions that I read works.

    For me the only workaround is set the AFSecurityPolicy like this:

    AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
    securityPolicy.allowInvalidCertificates = YES;
    manager.securityPolicy = securityPolicy;
    

    I decided to reply although the question is old, maybe can help someone.

提交回复
热议问题