是否可以将TrustKit(https://github.com/datatheorem/TrustKit)与AFNetworking集成?对IOS的任何建议? 谢谢!
答案 0 :(得分:1)
[manager setSessionDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, NSURLAuthenticationChallenge * _Nonnull challenge, NSURLCredential *__autoreleasing _Nullable * _Nullable credential) {
__block NSURLSessionAuthChallengeDisposition dispositionToReturn = NSURLSessionAuthChallengePerformDefaultHandling;
if (![TrustKit.sharedInstance.pinningValidator handleChallenge:challenge completionHandler:^(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential) {
dispositionToReturn = disposition;
}]){
return NSURLSessionAuthChallengePerformDefaultHandling;
}
return dispositionToReturn;
}];