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
Related Documentation
Revision History
時間 | 描述 |
---|---|
2017-02-10 | 博文完成 |
Copyright
CSDN:http://blog.csdn.net/y550918116j
GitHub:https://github.com/937447974