     
 }
 
-public typealias challengeHandler = (challenge: URLAuthenticationChallenge, completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void)
-/*
- 提供凭据
- */
+
 public class WTURLSessionDelegate:NSObject,URLSessionDataDelegate{
     
     

    }
    
    public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void){
        //        if (challengeHandler != nil) {
        //            challengeHandler?(challenge: challenge,completionHandler: completionHandler)
        //        }
        /*
         public typealias challengeHandler = (challenge: URLAuthenticationChallenge, completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void)
         */
        //        if let handler:challengeHandler = challengeHandler{
        //            handler(challenge:challenge,completionHandler:)
        //        }
        
        
        
        let disposition: Foundation.URLSession.AuthChallengeDisposition = .performDefaultHandling
        var credential:URLCredential? = self.credential
        //1.认证方法是服务端信任
        if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
            //2.如果服务端信任存在
            if let serverTrust = challenge.protectionSpace.serverTrust {
                //3.验证服务端的信任
                if self.trustIsValid(serverTrust) {
                    //4.如果验证成功了,使用服务端的信任创建凭据
                    credential = URLCredential(trust: serverTrust)
                }

public typealias jsonHandler = (object:AnyObject?,error:NSError?)->Void
public typealias imageHandler = (image:UIImage?,error:NSError?)->Void
public typealias stringHandler = (string:String?,error:NSError?)->Void


public typealias challengeHandler = ((Foundation.URLSession, URLAuthenticationChallenge) -> (Foundation.URLSession.AuthChallengeDisposition, URLCredential?))

public class WTURLSessionTask:NSObject,URLSessionDataDelegate,URLSessionTaskDelegate{
    //网址凭据
    public var credential: URLCredential?
    public var completionHandler:completionHandler?
