URLProtocolClient

URLProtocolClient主要用於對自定義的NSURLProtocol子類提供URL數據交互接口。

Symbols

1 Protocol Methods

// 重定向請求和返回數據
public func urlProtocol(_ protocol: URLProtocol, wasRedirectedTo request: URLRequest, redirectResponse: URLResponse)

// 校驗緩存是有效的
public func urlProtocol(_ protocol: URLProtocol, cachedResponseIsValid cachedResponse: CachedURLResponse)

// 設置請求回調數據的緩存策略
public func urlProtocol(_ protocol: URLProtocol, didReceive response: URLResponse, cacheStoragePolicy policy: URLCache.StoragePolicy)
// 回調請求對應的數據
public func urlProtocol(_ protocol: URLProtocol, didLoad data: Data)

// 加載完畢
public func urlProtocolDidFinishLoading(_ protocol: URLProtocol)
// 加載出錯
public func urlProtocol(_ protocol: URLProtocol, didFailWithError error: Error)

// 啓動身份驗證
public func urlProtocol(_ protocol: URLProtocol, didReceive challenge: URLAuthenticationChallenge)
// 取消證書驗證
public func urlProtocol(_ protocol: URLProtocol, didCancel challenge: URLAuthenticationChallenge)

 


Appendix

Sample Code

Swift

URLProtocolClient

Revision History

時間 描述
2017-02-10 博文完成

CSDN:http://blog.csdn.net/y550918116j

GitHub:https://github.com/937447974

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章