1

是否可以将 TrustKit ( https://github.com/datatheorem/TrustKit ) 与 AFNetworking 集成?对IOS有什么建议吗?谢谢!

4

1 回答 1

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;
}];
于 2018-11-09T13:55:41.247 回答