我试图设置安全策略。看来它对我不起作用。即使我未在应用程序捆绑包中附加证书,所有api请求也都成功。我在自定义类init中编写以下代码。我在做错什么吗?
- (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration {
if (self = [super init]) {
self.urlSessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
self.urlSessionManager.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
}
return self;
}