gpt4 book ai didi

ios - AFNetworking SSL 请求

转载 作者:太空宇宙 更新时间:2023-11-03 13:44:21 25 4
gpt4 key购买 nike

我使用 AF 发送 https 请求,例如

    [self.manager POST:downloadURLStirng parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (success)
success(responseObject,passParameters);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
if(failure)
failure(operation.responseObject,error,passParameters);
}];

并且我已经将 securityPolicy 设置为 YES

    self.manager.requestSerializer = [AFJSONRequestSerializer serializer];
self.manager.securityPolicy.allowInvalidCertificates = OPENSSL;

但我仍然得到代码 -1012error_message:为了验证自签名证书的域名,您必须使用固定。

最佳答案

这是设置安全策略以允许无效证书并停止域名验证。:

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

[securityPolicy setValidatesDomainName:NO];

关于ios - AFNetworking SSL 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32198171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com