Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
URLSessionElegate方法的单元测试-Swift_Swift_Xcode_Unit Testing_Urlsession_Urlauthenticationchallenges - Fatal编程技术网

URLSessionElegate方法的单元测试-Swift

URLSessionElegate方法的单元测试-Swift,swift,xcode,unit-testing,urlsession,urlauthenticationchallenges,Swift,Xcode,Unit Testing,Urlsession,Urlauthenticationchallenges,我有一个名为CertificatePinningDelegate的自定义委托类,它符合URLSessionDelegate。我正在使用委托方法 urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)

我有一个名为
CertificatePinningDelegate
的自定义委托类,它符合
URLSessionDelegate
。我正在使用委托方法

urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) 
向服务器进行身份验证。现在我想为此编写一个单元测试

我一直在尝试手动调用委托方法来传递一个自定义的
URLAuthenticationChallenge
对象,这似乎是不可能的。有人知道这方面的其他/更好的选择吗