是否可以将TrustKit(https://github.com/datatheorem/TrustKit)与AFNetworking集成?对IOS有什么建议吗?
谢谢!
最佳答案
[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;
}];
关于ios - TrustKit和AFNetworking之间的集成,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49797322/