Интеграция между TrustKit и AFNetworking

Можно ли интегрировать TrustKit ( https://github.com/datatheorem/TrustKit) с AFNetworking? Любое предложение для IOS? Спасибо!

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;
}];
Другие вопросы по тегам