URLSessionManager

open class URLSessionManager : NSObject, URLSessionDelegate, URLSessionTaskDelegate, URLSessionDataDelegate, URLSessionDownloadDelegate

URLSession管理器

AFNetworking

  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidResumeNotification: Notification.Name
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidCompleteNotification: Notification.Name
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidSuspendNotification: Notification.Name
  • Undocumented

    Declaration

    Swift

    public static let urlSessionDidInvalidateNotification: Notification.Name
  • Undocumented

    Declaration

    Swift

    public static let urlSessionDownloadTaskDidMoveFileSuccessfullyNotification: Notification.Name
  • Undocumented

    Declaration

    Swift

    public static let urlSessionDownloadTaskDidFailToMoveFileNotification: Notification.Name
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidCompleteResponseDataKey: String
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidCompleteSerializedResponseKey: String
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidCompleteResponseSerializerKey: String
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidCompleteAssetPathKey: String
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidCompleteErrorKey: String
  • Undocumented

    Declaration

    Swift

    public static let networkingTaskDidCompleteSessionTaskMetrics: String
  • Undocumented

    Declaration

    Swift

    open private(set) lazy var session: URLSession { get set }
  • Undocumented

    Declaration

    Swift

    open private(set) var operationQueue: OperationQueue { get }
  • Undocumented

    Declaration

    Swift

    open var responseSerializer: HTTPResponseSerializer
  • Undocumented

    Declaration

    Swift

    open var securityPolicy: SecurityPolicy
  • Undocumented

    Declaration

    Swift

    open var tasks: [URLSessionTask] { get }
  • Undocumented

    Declaration

    Swift

    open var dataTasks: [URLSessionDataTask] { get }
  • Undocumented

    Declaration

    Swift

    open var uploadTasks: [URLSessionUploadTask] { get }
  • Undocumented

    Declaration

    Swift

    open var downloadTasks: [URLSessionDownloadTask] { get }
  • Undocumented

    Declaration

    Swift

    open var completionQueue: DispatchQueue?
  • Undocumented

    Declaration

    Swift

    open var completionGroup: DispatchGroup?
  • Undocumented

    Declaration

    Swift

    open var sessionDidBecomeInvalid: ((_ session: URLSession, _ error: Error?) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var sessionDidReceiveAuthenticationChallenge: ((_ session: URLSession, _ challenge: URLAuthenticationChallenge, _ credential: inout URLCredential?) -> URLSession.AuthChallengeDisposition)?
  • Undocumented

    Declaration

    Swift

    open var taskNeedNewBodyStream: ((_ session: URLSession, _ task: URLSessionTask) -> InputStream)?
  • Undocumented

    Declaration

    Swift

    open var taskWillPerformHTTPRedirection: ((_ session: URLSession, _ task: URLSessionTask, _ response: URLResponse, _ request: URLRequest) -> URLRequest?)?
  • Undocumented

    Declaration

    Swift

    open var authenticationChallengeHandler: ((_ session: URLSession, _ task: URLSessionTask, _ challenge: URLAuthenticationChallenge, _ completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Any?)?
  • Undocumented

    Declaration

    Swift

    open var taskDidSendBodyData: ((_ session: URLSession, _ task: URLSessionTask, _ bytesSent: Int64, _ totalBytesSent: Int64, _ totalBytesExpectedToSend: Int64) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var taskDidComplete: ((_ session: URLSession, _ task: URLSessionTask, _ error: Error?) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var taskDidFinishCollectingMetrics: ((_ session: URLSession, _ task: URLSessionTask, _ metrics: URLSessionTaskMetrics?) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var dataTaskDidReceiveResponse: ((_ session: URLSession, _ task: URLSessionDataTask, _ response: URLResponse) -> URLSession.ResponseDisposition)?
  • Undocumented

    Declaration

    Swift

    open var dataTaskDidBecomeDownloadTask: ((_ session: URLSession, _ dataTask: URLSessionDataTask, _ downloadTask: URLSessionDownloadTask) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var dataTaskDidReceiveData: ((_ session: URLSession, _ dataTask: URLSessionDataTask, _ data: Data) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var dataTaskWillCacheResponse: ((_ session: URLSession, _ dataTask: URLSessionDataTask, _ proposedResponse: CachedURLResponse) -> CachedURLResponse)?
  • Undocumented

    Declaration

    Swift

    open var didFinishEventsForBackgroundURLSession: ((_ session: URLSession) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var downloadTaskDidFinishDownloading: ((_ session: URLSession, _ downloadTask: URLSessionDownloadTask, _ location: URL) -> URL?)?
  • Undocumented

    Declaration

    Swift

    open var downloadTaskDidWriteData: ((_ session: URLSession, _ downloadTask: URLSessionDownloadTask, _ bytesWritten: Int64, _ totalBytesWritten: Int64, _ totalBytesExpectedToWrite: Int64) -> Void)?
  • Undocumented

    Declaration

    Swift

    open var downloadTaskDidResume: ((_ session: URLSession, _ downloadTask: URLSessionDownloadTask, _ fileOffset: Int64, _ expectedTotalBytes: Int64) -> Void)?
  • Undocumented

    Declaration

    Swift

    public convenience override init()
  • Undocumented

    Declaration

    Swift

    public init(sessionConfiguration: URLSessionConfiguration?)
  • Undocumented

    Declaration

    Swift

    open func invalidateSessionCancelingTasks(_ cancelPendingTasks: Bool, resetSession: Bool)
  • Undocumented

    Declaration

    Swift

    open func dataTask(
        request: URLRequest,
        uploadProgress: ((Progress) -> Void)? = nil,
        downloadProgress: ((Progress) -> Void)? = nil,
        completionHandler: ((_ response: URLResponse, _ responseObject: Any?, _ error: Error?) -> Void)? = nil
    ) -> URLSessionDataTask
  • Undocumented

    Declaration

    Swift

    open func uploadTask(
        request: URLRequest,
        fromFile fileURL: URL,
        progress: ((Progress) -> Void)? = nil,
        completionHandler: ((_ response: URLResponse, _ responseObject: Any?, _ error: Error?) -> Void)? = nil
    ) -> URLSessionUploadTask
  • Undocumented

    Declaration

    Swift

    open func uploadTask(
        request: URLRequest,
        fromData bodyData: Data,
        progress: ((Progress) -> Void)? = nil,
        completionHandler: ((_ response: URLResponse, _ responseObject: Any?, _ error: Error?) -> Void)? = nil
    ) -> URLSessionUploadTask
  • Undocumented

    Declaration

    Swift

    open func uploadTask(
        streamedRequest: URLRequest,
        progress: ((Progress) -> Void)? = nil,
        completionHandler: ((_ response: URLResponse, _ responseObject: Any?, _ error: Error?) -> Void)? = nil
    ) -> URLSessionUploadTask
  • Undocumented

    Declaration

    Swift

    open func downloadTask(
        request: URLRequest,
        progress: ((Progress) -> Void)? = nil,
        destination: ((_ targetPath: URL, _ response: URLResponse) -> URL)? = nil,
        completionHandler: ((_ response: URLResponse, _ filePath: URL?, _ error: Error?) -> Void)? = nil
    ) -> URLSessionDownloadTask
  • Undocumented

    Declaration

    Swift

    open func downloadTask(
        resumeData: Data,
        progress: ((Progress) -> Void)? = nil,
        destination: ((_ targetPath: URL, _ response: URLResponse) -> URL)? = nil,
        completionHandler: ((_ response: URLResponse, _ filePath: URL?, _ error: Error?) -> Void)? = nil
    ) -> URLSessionDownloadTask
  • Undocumented

    Declaration

    Swift

    open func uploadProgress(for task: URLSessionTask) -> Progress?
  • Undocumented

    Declaration

    Swift

    open func downloadProgress(for task: URLSessionTask) -> Progress?
  • Undocumented

    Declaration

    Swift

    open func setUserInfo(_ userInfo: [AnyHashable : Any]?, for task: URLSessionTask)
  • Undocumented

    Declaration

    Swift

    open func userInfo(for task: URLSessionTask) -> [AnyHashable : Any]?

URLSessionDelegate

  • Undocumented

    Declaration

    Swift

    open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?)
  • Undocumented

    Declaration

    Swift

    open func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)

URLSessionTaskDelegate

URLSessionDataDelegate

URLSessionDownloadDelegate

NSObject

  • Undocumented

    Declaration

    Swift

    open override var description: String { get }
  • Undocumented

    Declaration

    Swift

    open override func responds(to selector: Selector!) -> Bool