Unable to use self signed certificate with AFNetworking 2

后端 未结 4 2036
时光取名叫无心
时光取名叫无心 2021-01-01 07:00

I put the .cer certificate used by the Apache Server in the Xcode project. When the app tries to talk to the server I get this error in Xcode:

Assertion fail         


        
4条回答
  •  独厮守ぢ
    2021-01-01 07:01

    If required, you can disable the invalid certificate check by changing your security policy.

    [self setAllowInvalidCertificates:YES];
    

    Please read more in the documentation: http://cocoadocs.org/docsets/AFNetworking/2.0.3/Classes/AFSecurityPolicy.html#//api/name/allowInvalidCertificates

    You can also pin the certificate: http://cocoadocs.org/docsets/AFNetworking/2.0.3/Classes/AFSecurityPolicy.html#//api/name/pinnedCertificates

提交回复
热议问题